# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1041617 | 2024-08-02T06:19:41 Z | 김은성(#11000) | Brought Down the Grading Server? (CEOI23_balance) | C++17 | 2000 ms | 19472 KB |
#include <bits/stdc++.h> using namespace std; int n, s, t, *a[100009]; vector<pair<int, int> > graph[100009]; int ans[100009]; int deg[100009]; //out - in; int cur[100009]; void findcycle(int v){ for(int i = cur[v]; i<graph[v].size(); i++){ if(i < cur[v]) i = cur[v]; if(i == graph[v].size()) break; auto [idx, u] = graph[v][i]; if(ans[idx] != -1) continue; ans[idx] = v; cur[v]++; deg[v]++; deg[u]--; findcycle(u); } } int main(){ int i, j; scanf("%d %d %d", &n, &s, &t); memset(ans, -1, sizeof(ans)); for(i=0; i<n; i++){ a[i] = (int*)malloc(s * sizeof(int)); for(j=0; j<s; j++){ scanf("%d", &a[i][j]); } graph[a[i][0]].push_back(make_pair(i, a[i][1])); graph[a[i][1]].push_back(make_pair(i, a[i][0])); } for(i=1; i<=t; i++){ findcycle(i); } for(i=1; i<=t; i++){ assert(-1 <= deg[i] && deg[i] <= 1); } for(i=0; i<n; i++){ printf("%d %d\n", ans[i], a[i][0] + a[i][1] - ans[i]); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4444 KB | Correct |
2 | Incorrect | 1 ms | 4444 KB | Unexpected end of file - int32 expected |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4596 KB | Correct |
2 | Runtime error | 5 ms | 8796 KB | Execution killed with signal 6 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 50 ms | 19472 KB | Correct |
2 | Correct | 892 ms | 19052 KB | Correct |
3 | Correct | 77 ms | 17572 KB | Correct |
4 | Correct | 1758 ms | 17248 KB | Correct |
5 | Execution timed out | 2072 ms | 17712 KB | Time limit exceeded |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 50 ms | 19472 KB | Correct |
2 | Correct | 892 ms | 19052 KB | Correct |
3 | Correct | 77 ms | 17572 KB | Correct |
4 | Correct | 1758 ms | 17248 KB | Correct |
5 | Execution timed out | 2072 ms | 17712 KB | Time limit exceeded |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 4596 KB | Correct |
2 | Runtime error | 5 ms | 8796 KB | Execution killed with signal 6 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 4444 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 4444 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 4444 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 50 ms | 19472 KB | Correct |
2 | Correct | 892 ms | 19052 KB | Correct |
3 | Correct | 77 ms | 17572 KB | Correct |
4 | Correct | 1758 ms | 17248 KB | Correct |
5 | Execution timed out | 2072 ms | 17712 KB | Time limit exceeded |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 50 ms | 19472 KB | Correct |
2 | Correct | 892 ms | 19052 KB | Correct |
3 | Correct | 77 ms | 17572 KB | Correct |
4 | Correct | 1758 ms | 17248 KB | Correct |
5 | Execution timed out | 2072 ms | 17712 KB | Time limit exceeded |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4444 KB | Correct |
2 | Incorrect | 1 ms | 4444 KB | Unexpected end of file - int32 expected |
3 | Halted | 0 ms | 0 KB | - |