Submission #68139

# Submission time Handle Problem Language Result Execution time Memory
68139 2018-08-16T06:45:19 Z MrTEK Conspiracy (POI11_kon) C++14
90 / 100
1127 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);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 3 ms 336 KB Output is correct
3 Correct 2 ms 416 KB Output is correct
4 Correct 3 ms 472 KB Output is correct
5 Correct 2 ms 472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 472 KB Output is correct
2 Correct 2 ms 640 KB Output is correct
3 Correct 2 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 640 KB Output is correct
2 Correct 2 ms 640 KB Output is correct
3 Correct 3 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 640 KB Output is correct
2 Correct 3 ms 680 KB Output is correct
3 Correct 3 ms 708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 756 KB Output is correct
2 Correct 5 ms 800 KB Output is correct
3 Correct 4 ms 936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 1152 KB Output is correct
2 Correct 29 ms 3752 KB Output is correct
3 Correct 137 ms 16884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 17168 KB Output is correct
2 Correct 39 ms 21016 KB Output is correct
3 Correct 181 ms 38716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 41432 KB Output is correct
2 Correct 131 ms 50112 KB Output is correct
3 Correct 290 ms 79264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 55 ms 83900 KB Output is correct
2 Correct 223 ms 89644 KB Output is correct
3 Correct 767 ms 89644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 461 ms 89668 KB Output is correct
2 Correct 354 ms 120640 KB Output is correct
3 Runtime error 1127 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.
4 Halted 0 ms 0 KB -