Submission #161213

# Submission time Handle Problem Language Result Execution time Memory
161213 2019-11-01T12:36:20 Z tincamatei Party (POI11_imp) C++14
100 / 100
863 ms 33620 KB
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 3000;
bitset<MAX_N> adj[MAX_N];

bool inClique(const vector<int> &clique, int nod) {
	for(auto it: clique)
		if(!adj[it][nod])
			return false;
	
	return true;
}

int main() {
	int N, M, T;
	int x = 1;
	vector<int> solution;

	scanf("%d%d", &N, &M);
	for(int i = 0; i < M; ++i) {
		int a, b;
		scanf("%d%d",  &a, &b);
		adj[a][b] = adj[b][a] = true;
	}

	T = N / 3;

	solution.push_back(0);
	for(int i = 1; i < N && solution.size() < T; ++i) {
		if(inClique(solution, i)) {
			solution.push_back(i);
			++x;
		} else {
			--x;
			if(x == -1) {
				x = 1;
				solution.clear();
				solution.push_back(i);
			}
		}
	}

	for(auto it: solution)
		printf("%d ", it);

	return 0;
}

Compilation message

imp.cpp: In function 'int main()':
imp.cpp:31:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 1; i < N && solution.size() < T; ++i) {
                          ~~~~~~~~~~~~~~~~^~~
imp.cpp:21:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &N, &M);
  ~~~~~^~~~~~~~~~~~~~~~
imp.cpp:24:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",  &a, &b);
   ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 22 ms 1272 KB Output is correct
3 Correct 25 ms 1244 KB Output is correct
4 Correct 38 ms 1272 KB Output is correct
5 Correct 23 ms 1144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 948 KB Output is correct
2 Correct 84 ms 3576 KB Output is correct
3 Correct 85 ms 3576 KB Output is correct
4 Correct 83 ms 3576 KB Output is correct
5 Correct 84 ms 3764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 1400 KB Output is correct
2 Correct 192 ms 4712 KB Output is correct
3 Correct 188 ms 4856 KB Output is correct
4 Correct 193 ms 4728 KB Output is correct
5 Correct 199 ms 4856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 59 ms 2808 KB Output is correct
2 Correct 286 ms 4056 KB Output is correct
3 Correct 289 ms 4344 KB Output is correct
4 Correct 285 ms 4216 KB Output is correct
5 Correct 283 ms 4088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 173 ms 4700 KB Output is correct
2 Correct 368 ms 4012 KB Output is correct
3 Correct 359 ms 4008 KB Output is correct
4 Correct 443 ms 4088 KB Output is correct
5 Correct 371 ms 4088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 326 ms 3988 KB Output is correct
2 Correct 477 ms 1276 KB Output is correct
3 Correct 477 ms 1400 KB Output is correct
4 Correct 517 ms 1356 KB Output is correct
5 Correct 478 ms 1400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 415 ms 3912 KB Output is correct
2 Correct 551 ms 1656 KB Output is correct
3 Correct 564 ms 1400 KB Output is correct
4 Correct 582 ms 1400 KB Output is correct
5 Correct 574 ms 1420 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 498 ms 1540 KB Output is correct
2 Correct 685 ms 1512 KB Output is correct
3 Correct 665 ms 1528 KB Output is correct
4 Correct 665 ms 1528 KB Output is correct
5 Correct 861 ms 1528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 587 ms 1376 KB Output is correct
2 Correct 781 ms 1556 KB Output is correct
3 Correct 806 ms 1548 KB Output is correct
4 Correct 810 ms 1628 KB Output is correct
5 Correct 780 ms 1528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 760 ms 1612 KB Output is correct
2 Correct 847 ms 33620 KB Output is correct
3 Correct 843 ms 33016 KB Output is correct
4 Correct 850 ms 33116 KB Output is correct
5 Correct 863 ms 33348 KB Output is correct