답안 #80887

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
80887 2018-10-22T17:20:00 Z farukkastamonuda Conspiracy (POI11_kon) C++14
90 / 100
3000 ms 132096 KB
#include <bits/stdc++.h>

#define fi first

#define se second

#define lo long long 

#define inf 1000000000

#define md 1000000007

#define li 5000

#define mp make_pair

#define pb push_back

using namespace std;

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:24:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
kon.cpp:28:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &deg);
   ~~~~~^~~~~~~~~~~~
kon.cpp:32:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", &x);
    ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 484 KB Output is correct
3 Correct 2 ms 484 KB Output is correct
4 Correct 2 ms 484 KB Output is correct
5 Correct 2 ms 484 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 496 KB Output is correct
2 Correct 2 ms 580 KB Output is correct
3 Correct 2 ms 620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 624 KB Output is correct
2 Correct 3 ms 628 KB Output is correct
3 Correct 3 ms 640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 656 KB Output is correct
2 Correct 5 ms 672 KB Output is correct
3 Correct 3 ms 752 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1004 KB Output is correct
2 Correct 6 ms 1016 KB Output is correct
3 Correct 5 ms 1152 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 1384 KB Output is correct
2 Correct 82 ms 3924 KB Output is correct
3 Correct 369 ms 17056 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 17448 KB Output is correct
2 Correct 109 ms 21216 KB Output is correct
3 Correct 491 ms 38928 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 88 ms 41656 KB Output is correct
2 Correct 235 ms 50568 KB Output is correct
3 Correct 790 ms 79528 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 128 ms 84296 KB Output is correct
2 Correct 585 ms 96292 KB Output is correct
3 Correct 1840 ms 96292 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1324 ms 96300 KB Output is correct
2 Correct 835 ms 102936 KB Output is correct
3 Correct 2772 ms 102936 KB Output is correct
4 Execution timed out 3077 ms 132096 KB Time limit exceeded
5 Halted 0 ms 0 KB -