Submission #29804

# Submission time Handle Problem Language Result Execution time Memory
29804 2017-07-21T01:54:21 Z Diuven Ronald (COCI17_ronald) C++11
120 / 120
56 ms 3020 KB
#include <bits/stdc++.h>
int n, i, m, D[1010], a, b;
bool G[1010][1010], flag=true;
void toggle(int v){
	for(int k=1; k<=n; k++){
		if(k==v)	continue;
		if(G[v][k])
			G[v][k]=G[k][v]=false, D[v]--, D[k]--;
		else
			G[v][k]=G[k][v]=true, D[v]++, D[k]++;
	}
}
int main(){
	scanf("%d%d", &n, &m);
	for(; m--; ){
		scanf("%d%d", &a, &b);
		G[a][b]=G[b][a]=true;
		D[a]++, D[b]++;
	}
	for(i=2; i<=n; i++)
		if(!G[1][i])	toggle(i);
	for(i=1; i<=n; i++)
		flag&=(D[i]==n-1);
	puts(flag?"DA":"NE");
	return 0;
}

Compilation message

ronald.cpp: In function 'int main()':
ronald.cpp:14:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &n, &m);
                       ^
ronald.cpp:16:24: 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 0 ms 3020 KB Output is correct
2 Correct 0 ms 3020 KB Output is correct
3 Correct 0 ms 3020 KB Output is correct
4 Correct 0 ms 3020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3020 KB Output is correct
2 Correct 0 ms 3020 KB Output is correct
3 Correct 0 ms 3020 KB Output is correct
4 Correct 0 ms 3020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3020 KB Output is correct
2 Correct 0 ms 3020 KB Output is correct
3 Correct 0 ms 3020 KB Output is correct
4 Correct 0 ms 3020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3020 KB Output is correct
2 Correct 0 ms 3020 KB Output is correct
3 Correct 0 ms 3020 KB Output is correct
4 Correct 0 ms 3020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3020 KB Output is correct
2 Correct 0 ms 3020 KB Output is correct
3 Correct 0 ms 3020 KB Output is correct
4 Correct 0 ms 3020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3020 KB Output is correct
2 Correct 0 ms 3020 KB Output is correct
3 Correct 0 ms 3020 KB Output is correct
4 Correct 0 ms 3020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 3020 KB Output is correct
2 Correct 16 ms 3020 KB Output is correct
3 Correct 3 ms 3020 KB Output is correct
4 Correct 0 ms 3020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 3020 KB Output is correct
2 Correct 6 ms 3020 KB Output is correct
3 Correct 36 ms 3020 KB Output is correct
4 Correct 56 ms 3020 KB Output is correct