Submission #80888

# Submission time Handle Problem Language Result Execution time Memory
80888 2018-10-22T17:21:57 Z farukkastamonuda Conspiracy (POI11_kon) C++14
100 / 100
2882 ms 107472 KB
#include <bits/stdc++.h>

using namespace std;
const int li = 5000;

int n, deg, x, gg[li], tut[li], topla, cev, edge, sum, last;

int main(){
	scanf("%d", &n);
	
	for(int i = 1; i <= n; i ++){
		
		scanf("%d", &deg);
		
		for(int j = 1 ;j <= deg; j ++){
			
			scanf("%d", &x);
			
		}
		
		topla += deg;
		
		gg[deg] ++;
		
	}
	
	edge = topla / 2;
	
	//int last = 0;
	for(int i = n - 1; i >= 0; i --){
		
		for(int j = gg[i]; j >= 1 ; j --){
			
			tut[last ++] = i;
			
		}
	}
	//int sum = 0;
	for(int i = 0; i< n - 1; i ++){
		
		sum = sum + tut[i] - i;
		
		if(sum == edge){
			
			if(tut[i] == tut[i + 1]){
				
				cev += gg[ tut[i] ];
				
			}
			
			else cev += 1;
		} 
		
	}
	
	printf("%d\n", cev);
	
	return 0;
}

Compilation message

kon.cpp: In function 'int main()':
kon.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
kon.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &deg);
   ~~~~~^~~~~~~~~~~~
kon.cpp:17:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", &x);
    ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 388 KB Output is correct
3 Correct 2 ms 560 KB Output is correct
4 Correct 2 ms 560 KB Output is correct
5 Correct 2 ms 560 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 560 KB Output is correct
2 Correct 2 ms 576 KB Output is correct
3 Correct 2 ms 576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 576 KB Output is correct
2 Correct 2 ms 628 KB Output is correct
3 Correct 3 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 656 KB Output is correct
2 Correct 6 ms 676 KB Output is correct
3 Correct 4 ms 756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 804 KB Output is correct
2 Correct 6 ms 996 KB Output is correct
3 Correct 5 ms 1000 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 1344 KB Output is correct
2 Correct 75 ms 3976 KB Output is correct
3 Correct 348 ms 17060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 17448 KB Output is correct
2 Correct 106 ms 21192 KB Output is correct
3 Correct 462 ms 38928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 85 ms 41652 KB Output is correct
2 Correct 283 ms 50412 KB Output is correct
3 Correct 807 ms 79552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 122 ms 82504 KB Output is correct
2 Correct 504 ms 90960 KB Output is correct
3 Correct 1713 ms 91976 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1184 ms 91976 KB Output is correct
2 Correct 816 ms 101348 KB Output is correct
3 Correct 2619 ms 101348 KB Output is correct
4 Correct 2882 ms 107404 KB Output is correct
5 Correct 2 ms 107472 KB Output is correct