# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
68138 | MrTEK | Untitled (POI11_kon) | C++14 | 861 ms | 132096 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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", ¤tDegree);
++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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |