bzoj2530 [Poi2011]Party
Posted zbtrs
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了bzoj2530 [Poi2011]Party相关的知识,希望对你有一定的参考价值。
2530: [Poi2011]Party
Time Limit: 10 Sec Memory Limit: 128 MBSec Special JudgeSubmit: 342 Solved: 196
[Submit][Status][Discuss]
Description
请输出该图的任意一个大小为N/3的团。 一个团的定义为节点的一个子集,该子集中的点两两有直接连边。 输入: 第一行是两个整数N,M。 接下来有M行,每行两个整数A,B,表示A和B有连边。保证无重边。 输出: N/3个整数,表示你找到的团。 数据范围:
3<=N<=3000,[3/2 n(2/3 n -1)]/2<=M<=[n(n-1)/2]
Input
In the first line of the standard input two integers, n and M(3<=N<=3000,[3/2 n(2/3 n -1)]/2<=M<=[n(n-1)/2]), are given, separated by a single space. These denote the number of Byteasar‘s friends and the number of pairs of his friends who know each other, respectively. Byteasar‘s friends are numbered from 1 to . Each of the following lines holds two integers separated by a single space. The numbers in line no.i+1(for i=1,2,...,m) are Ai and Bi(1<=Ai<Bi<=N), separated by a single space, which denote that the persons Ai and Bi now each other. Every pair of numbers appears at most once on the input.
Output
Sample Input
2 5
1 4
1 5
2 4
1 3
4 5
4 6
3 5
3 4
3 6
Sample Output
HINT
Explanation of the example: Byteasar‘s friends numbered 1, 3, 4, 5 know
one another. However, any pair of Byteasar‘s friends who know each
other, like 2 and 4 for instance, constitutes a correct solution, i.e.,
such a pair needs not be part of aforementioned quadruple.
Source
分析:一道构造题,每次找一对没有连边的点,这一对点中至少有一个不在团中,都删掉,打上标记,就能防止删除一定在团中的点,因为有一个不超过2n/3的团,所以最多删掉2n/3个点,最后剩下的点个数一定大于等于n/3.
以上是关于bzoj2530 [Poi2011]Party的主要内容,如果未能解决你的问题,请参考以下文章
BZOJ2212 [Poi2011]Tree Rotations 线段树合并 逆序对
bzoj 2212 : [Poi2011]Tree Rotations (线段树合并)