10
23
2015
1

BZOJ1006:[HNOI2008]神奇的国度

 

#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
vector <int> g[10001];
int n, m, ans = 0, sum[10001], list[10001], color[10001], hash[10001];
bool mark[10001];
void init() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i++) g[i].clear();
	for (int i = 1, x, y; i <= m; i++) {
		scanf("%d%d", &x, &y);
		g[x].push_back(y);
		g[y].push_back(x);
	}
}
int main() {
	init();
	for (int i = n; i; i--) {
		int t = 0;
		for (int j = 1; j <= n; j++)
			if (!mark[j] && sum[j] >= sum[t]) t = j;
		mark[t] = true; list[i] = t;
		for (int j = 0; j < g[t].size(); j++)
			sum[g[t][j]]++;
	}
	for (int i = n; i; i--) {
		int t = list[i];
		for (int j = 0; j < g[t].size(); j++) hash[color[g[t][j]]] = i;
		int j;
		for (j = 1; ; j++) if (hash[j] != i) break;
		color[t] = j;
		if (j > ans) ans = j;
	}
	printf("%d\n", ans);
	return 0;
}
Category: 未分类 | Tags: 图论 最大团 染色 完美消除序列 | Read Count: 548
Avatar_small
PAN India meaning 说:
2022年8月08日 00:00

PAN is abbreviated as Presence Across Nation and is operating or available at every possible location. A mark of PAN India is given to an organization or firm or company if their entity or branches are spread across every state and their customers can avail of their services from anywhere in India. PAN India meaning If any company operates at one location at the start and has spread its branches to various cities of India, then that company can use the recognition to announce its company growth.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter

Host by is-Programmer.com | Power by Chito 1.3.3 beta | Theme: Aeros 2.0 by TheBuckmaker.com