Submission #161211

# Submission time Handle Problem Language Result Execution time Memory
161211 2019-11-01T12:34:46 Z tincamatei Party (POI11_imp) C++14
90 / 100
1350 ms 46660 KB
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 3000;
bool adj[MAX_N][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 380 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 3 ms 504 KB Output is correct
4 Correct 3 ms 632 KB Output is correct
5 Correct 3 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 1016 KB Output is correct
2 Correct 24 ms 2552 KB Output is correct
3 Correct 23 ms 2552 KB Output is correct
4 Correct 25 ms 2552 KB Output is correct
5 Correct 24 ms 2552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 1912 KB Output is correct
2 Correct 90 ms 6264 KB Output is correct
3 Correct 92 ms 6136 KB Output is correct
4 Correct 93 ms 6244 KB Output is correct
5 Correct 97 ms 6356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 30 ms 3064 KB Output is correct
2 Correct 261 ms 11996 KB Output is correct
3 Correct 258 ms 11924 KB Output is correct
4 Correct 220 ms 11944 KB Output is correct
5 Correct 217 ms 12024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 65 ms 5112 KB Output is correct
2 Correct 394 ms 16500 KB Output is correct
3 Correct 410 ms 16376 KB Output is correct
4 Correct 388 ms 16504 KB Output is correct
5 Correct 410 ms 16520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 217 ms 11324 KB Output is correct
2 Correct 475 ms 19828 KB Output is correct
3 Correct 506 ms 19584 KB Output is correct
4 Correct 512 ms 19704 KB Output is correct
5 Correct 517 ms 19720 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 559 ms 18324 KB Output is correct
2 Correct 710 ms 25472 KB Output is correct
3 Correct 690 ms 25060 KB Output is correct
4 Correct 721 ms 25464 KB Output is correct
5 Correct 699 ms 25224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 640 ms 23304 KB Output is correct
2 Correct 850 ms 29660 KB Output is correct
3 Correct 847 ms 29080 KB Output is correct
4 Correct 857 ms 29616 KB Output is correct
5 Correct 815 ms 29304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 744 ms 26972 KB Output is correct
2 Correct 988 ms 34184 KB Output is correct
3 Correct 1006 ms 33880 KB Output is correct
4 Correct 1068 ms 33912 KB Output is correct
5 Correct 1008 ms 33784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 867 ms 31112 KB Output is correct
2 Correct 1350 ms 38772 KB Output is correct
3 Correct 1142 ms 38388 KB Output is correct
4 Correct 1174 ms 38360 KB Output is correct
5 Correct 1207 ms 38404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 1110 ms 46660 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -