Submission #29330

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

int n, m, ind[3010], ad[3010][3010], chk[3010];
set<int> ss;
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;
		ind[x]++; ind[y]++;
	}
	for(int i = 0; i < n / 3; i++){
		int mx = 0, mi;
		for(int j = 1; j <= n; j++){
			if(chk[j]) continue;
			if(mx < ind[j]){
				mx = ind[j];
				mi = j;
			}
		}
		ss.insert(mi);
		chk[mi] = 1;
		for(int j = 1; j <= n; j++){
			if(ad[mi][j]) ind[j]--;
		}
	}
	for(auto &i : ss) printf("%d ", i);
	puts("");
}

Compilation message

imp.cpp: In function 'int main()':
imp.cpp:9: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:11: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 Incorrect 0 ms 37436 KB Nie wszystkie wypisane osoby siê znaja
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 37436 KB Nie wszystkie wypisane osoby siê znaja
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 37436 KB Nie wszystkie wypisane osoby siê znaja
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 37436 KB Nie wszystkie wypisane osoby siê znaja
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 129 ms 37436 KB Nie wszystkie wypisane osoby siê znaja
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 353 ms 37436 KB Nie wszystkie wypisane osoby siê znaja
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 663 ms 37436 KB Nie wszystkie wypisane osoby siê znaja
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 813 ms 37436 KB Nie wszystkie wypisane osoby siê znaja
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 989 ms 37436 KB Nie wszystkie wypisane osoby siê znaja
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1129 ms 37436 KB Nie wszystkie wypisane osoby siê znaja
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1439 ms 37436 KB Nie wszystkie wypisane osoby siê znaja
2 Halted 0 ms 0 KB -