답안 #68138

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
68138 2018-08-16T06:44:44 Z MrTEK Conspiracy (POI11_kon) C++14
80 / 100
861 ms 132096 KB
#include <cstdio>
 
const int N = 5000;
 
int n;
 
int count[N];
int degree[N];
 
int main() {
	scanf("%d", &n);
	int edges = 0;
	for (int i = 1; i <= n; ++i) {
		int currentDegree;
		scanf("%d", &currentDegree);
		++count[currentDegree];
		edges += currentDegree;
		while (getchar() != '\n'); // pomijamy opis krawedzi
	}
	edges /= 2;
	int last = 0;
	for (int i = n - 1; i >= 0; --i)
		for (int j = 0; j < count[i]; ++j)
			degree[last++] = i;
	int m = 1;
	int result = 0;
	int sum = 0;
	for (int i = 0; i < n - 1; ++i) {
		sum += degree[i] - i;
		if (sum == edges) {
			if (degree[i + 1] == degree[i])
				result += count[degree[i]];
			else
				++result;
		}
	}
	printf("%d\n", result);
 
}

Compilation message

kon.cpp: In function 'int main()':
kon.cpp:25:6: warning: unused variable 'm' [-Wunused-variable]
  int m = 1;
      ^
kon.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
kon.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &currentDegree);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 252 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 2 ms 396 KB Output is correct
4 Correct 3 ms 448 KB Output is correct
5 Correct 3 ms 584 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 584 KB Output is correct
2 Correct 3 ms 584 KB Output is correct
3 Correct 2 ms 620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 620 KB Output is correct
2 Correct 3 ms 620 KB Output is correct
3 Correct 2 ms 700 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 700 KB Output is correct
2 Correct 4 ms 752 KB Output is correct
3 Correct 3 ms 848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 896 KB Output is correct
2 Correct 4 ms 1068 KB Output is correct
3 Correct 4 ms 1124 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 1356 KB Output is correct
2 Correct 27 ms 3956 KB Output is correct
3 Correct 126 ms 17112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 17388 KB Output is correct
2 Correct 42 ms 21192 KB Output is correct
3 Correct 199 ms 38976 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 33 ms 41592 KB Output is correct
2 Correct 93 ms 50376 KB Output is correct
3 Correct 339 ms 79628 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 65 ms 84220 KB Output is correct
2 Correct 235 ms 104708 KB Output is correct
3 Runtime error 861 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
# 결과 실행 시간 메모리 Grader output
1 Runtime error 648 ms 132096 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -