Submission #29338

# Submission time Handle Problem Language Result Execution time Memory
29338 2017-07-19T02:55:14 Z 김동현(#1164) Party (POI11_imp) C++14
100 / 100
1703 ms 37412 KB
#include <bits/stdc++.h>
using namespace std;

int n, m, ad[3010][3010];
vector<vector<int>> v;

int main(){
	scanf("%d%d", &n, &m);
	for(int i = 0, x, y; i < m; i++){
		scanf("%d%d", &x, &y);
		ad[x][y] = ad[y][x] = 1;
	}
	v.push_back(vector<int>(1, 1));
	for(int x = 2; x <= n; x++){
		int can = 0;
		for(auto &i : v){
			int fl = 1;
			for(auto &j : i){
				if(!ad[j][x]){ fl = 0; break; }
			}
			if(!fl) continue;
			i.push_back(x);
			if(int(i.size()) >= n / 3){
				sort(i.begin(), i.end());
				for(auto &j : i) printf("%d ", j);
				puts("");
				return 0;
			}
			can = 1;
			break;
		}
		if(!can) v.push_back(vector<int>(1, x));
	}
}

Compilation message

imp.cpp: In function 'int main()':
imp.cpp:8:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &n, &m);
                       ^
imp.cpp:10:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &x, &y);
                        ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 37412 KB Output is correct
2 Correct 0 ms 37412 KB Output is correct
3 Correct 0 ms 37412 KB Output is correct
4 Correct 0 ms 37412 KB Output is correct
5 Correct 0 ms 37412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 37412 KB Output is correct
2 Correct 26 ms 37412 KB Output is correct
3 Correct 19 ms 37412 KB Output is correct
4 Correct 29 ms 37412 KB Output is correct
5 Correct 29 ms 37412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 37412 KB Output is correct
2 Correct 159 ms 37412 KB Output is correct
3 Correct 143 ms 37412 KB Output is correct
4 Correct 153 ms 37412 KB Output is correct
5 Correct 143 ms 37412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 37412 KB Output is correct
2 Correct 359 ms 37412 KB Output is correct
3 Correct 369 ms 37412 KB Output is correct
4 Correct 366 ms 37412 KB Output is correct
5 Correct 359 ms 37412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 113 ms 37412 KB Output is correct
2 Correct 556 ms 37412 KB Output is correct
3 Correct 543 ms 37412 KB Output is correct
4 Correct 526 ms 37412 KB Output is correct
5 Correct 566 ms 37412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 319 ms 37412 KB Output is correct
2 Correct 679 ms 37412 KB Output is correct
3 Correct 756 ms 37412 KB Output is correct
4 Correct 703 ms 37412 KB Output is correct
5 Correct 653 ms 37412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 549 ms 37412 KB Output is correct
2 Correct 856 ms 37412 KB Output is correct
3 Correct 843 ms 37412 KB Output is correct
4 Correct 849 ms 37412 KB Output is correct
5 Correct 826 ms 37412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 763 ms 37412 KB Output is correct
2 Correct 973 ms 37412 KB Output is correct
3 Correct 1143 ms 37412 KB Output is correct
4 Correct 1103 ms 37412 KB Output is correct
5 Correct 1083 ms 37412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1022 ms 37412 KB Output is correct
2 Correct 1196 ms 37412 KB Output is correct
3 Correct 1256 ms 37412 KB Output is correct
4 Correct 1233 ms 37412 KB Output is correct
5 Correct 1273 ms 37412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1046 ms 37412 KB Output is correct
2 Correct 1446 ms 37412 KB Output is correct
3 Correct 1456 ms 37412 KB Output is correct
4 Correct 1456 ms 37412 KB Output is correct
5 Correct 1269 ms 37412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1503 ms 37412 KB Output is correct
2 Correct 1556 ms 37412 KB Output is correct
3 Correct 1663 ms 37412 KB Output is correct
4 Correct 1529 ms 37412 KB Output is correct
5 Correct 1703 ms 37412 KB Output is correct