# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1041719 | 2024-08-02T07:23:20 Z | 김은성(#11000) | Brought Down the Grading Server? (CEOI23_balance) | C++17 | 66 ms | 19996 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]; bool ch[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]; cur[v]++; if(ans[idx] != -1) continue; ans[idx] = v; deg[v]++; deg[u]--; findcycle(u); } } void findpath(int v){ ch[v]= 1; 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]; cur[v]++; if(ans[idx] != -1) continue; ans[idx] = v; deg[v]++; deg[u]--; if(ch[u] || graph[u].size()%2 == 0){ findpath(u); break; } else{ ch[u] = 1; break; } } } 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++){ if(graph[i].size()%2 == 1 && !ch[i]) findpath(i), ch[i]=1; } memset(cur, 0, sizeof(cur)); 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]); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4440 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 | 1 ms | 4444 KB | Correct |
2 | Correct | 0 ms | 4444 KB | Correct |
3 | Correct | 0 ms | 4444 KB | Correct |
4 | Correct | 1 ms | 4444 KB | Correct |
5 | Correct | 1 ms | 4444 KB | Correct |
6 | Correct | 1 ms | 4444 KB | Correct |
7 | Correct | 1 ms | 4444 KB | Correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 45 ms | 19272 KB | Correct |
2 | Correct | 42 ms | 19148 KB | Correct |
3 | Correct | 37 ms | 17500 KB | Correct |
4 | Correct | 26 ms | 17424 KB | Correct |
5 | Correct | 37 ms | 19036 KB | Correct |
6 | Correct | 66 ms | 19796 KB | Correct |
7 | Correct | 38 ms | 12112 KB | Correct |
8 | Correct | 47 ms | 19888 KB | Correct |
9 | Correct | 36 ms | 19796 KB | Correct |
10 | Correct | 35 ms | 19796 KB | Correct |
11 | Correct | 34 ms | 19792 KB | Correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 45 ms | 19272 KB | Correct |
2 | Correct | 42 ms | 19148 KB | Correct |
3 | Correct | 37 ms | 17500 KB | Correct |
4 | Correct | 26 ms | 17424 KB | Correct |
5 | Correct | 37 ms | 19036 KB | Correct |
6 | Correct | 66 ms | 19796 KB | Correct |
7 | Correct | 38 ms | 12112 KB | Correct |
8 | Correct | 47 ms | 19888 KB | Correct |
9 | Correct | 36 ms | 19796 KB | Correct |
10 | Correct | 35 ms | 19796 KB | Correct |
11 | Correct | 34 ms | 19792 KB | Correct |
12 | Correct | 43 ms | 19284 KB | Correct |
13 | Correct | 57 ms | 19144 KB | Correct |
14 | Correct | 35 ms | 17488 KB | Correct |
15 | Correct | 28 ms | 17568 KB | Correct |
16 | Correct | 37 ms | 18884 KB | Correct |
17 | Correct | 50 ms | 19792 KB | Correct |
18 | Correct | 40 ms | 12116 KB | Correct |
19 | Correct | 34 ms | 19796 KB | Correct |
20 | Correct | 61 ms | 19796 KB | Correct |
21 | Correct | 50 ms | 19968 KB | Correct |
22 | Correct | 32 ms | 19780 KB | Correct |
23 | Correct | 44 ms | 12372 KB | Correct |
24 | Correct | 35 ms | 17776 KB | Correct |
25 | Correct | 62 ms | 12116 KB | Correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4444 KB | Correct |
2 | Correct | 0 ms | 4444 KB | Correct |
3 | Correct | 0 ms | 4444 KB | Correct |
4 | Correct | 1 ms | 4444 KB | Correct |
5 | Correct | 1 ms | 4444 KB | Correct |
6 | Correct | 1 ms | 4444 KB | Correct |
7 | Correct | 1 ms | 4444 KB | Correct |
8 | Correct | 45 ms | 19272 KB | Correct |
9 | Correct | 42 ms | 19148 KB | Correct |
10 | Correct | 37 ms | 17500 KB | Correct |
11 | Correct | 26 ms | 17424 KB | Correct |
12 | Correct | 37 ms | 19036 KB | Correct |
13 | Correct | 66 ms | 19796 KB | Correct |
14 | Correct | 38 ms | 12112 KB | Correct |
15 | Correct | 47 ms | 19888 KB | Correct |
16 | Correct | 36 ms | 19796 KB | Correct |
17 | Correct | 35 ms | 19796 KB | Correct |
18 | Correct | 34 ms | 19792 KB | Correct |
19 | Correct | 43 ms | 19284 KB | Correct |
20 | Correct | 57 ms | 19144 KB | Correct |
21 | Correct | 35 ms | 17488 KB | Correct |
22 | Correct | 28 ms | 17568 KB | Correct |
23 | Correct | 37 ms | 18884 KB | Correct |
24 | Correct | 50 ms | 19792 KB | Correct |
25 | Correct | 40 ms | 12116 KB | Correct |
26 | Correct | 34 ms | 19796 KB | Correct |
27 | Correct | 61 ms | 19796 KB | Correct |
28 | Correct | 50 ms | 19968 KB | Correct |
29 | Correct | 32 ms | 19780 KB | Correct |
30 | Correct | 44 ms | 12372 KB | Correct |
31 | Correct | 35 ms | 17776 KB | Correct |
32 | Correct | 62 ms | 12116 KB | Correct |
33 | Correct | 1 ms | 4444 KB | Correct |
34 | Correct | 1 ms | 4444 KB | Correct |
35 | Correct | 1 ms | 4444 KB | Correct |
36 | Correct | 1 ms | 4444 KB | Correct |
37 | Correct | 1 ms | 4444 KB | Correct |
38 | Correct | 1 ms | 4444 KB | Correct |
39 | Correct | 1 ms | 4444 KB | Correct |
40 | Correct | 50 ms | 19296 KB | Correct |
41 | Correct | 56 ms | 19048 KB | Correct |
42 | Correct | 33 ms | 17500 KB | Correct |
43 | Correct | 28 ms | 17332 KB | Correct |
44 | Correct | 62 ms | 18880 KB | Correct |
45 | Correct | 47 ms | 19612 KB | Correct |
46 | Correct | 35 ms | 12112 KB | Correct |
47 | Correct | 40 ms | 19772 KB | Correct |
48 | Correct | 37 ms | 19792 KB | Correct |
49 | Correct | 36 ms | 19996 KB | Correct |
50 | Correct | 46 ms | 19796 KB | Correct |
51 | Correct | 43 ms | 12372 KB | Correct |
52 | Correct | 35 ms | 17744 KB | Correct |
53 | Correct | 60 ms | 12112 KB | Correct |
54 | Correct | 24 ms | 8788 KB | Correct |
55 | Correct | 2 ms | 4696 KB | Correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 4440 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 4440 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 4440 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 45 ms | 19272 KB | Correct |
2 | Correct | 42 ms | 19148 KB | Correct |
3 | Correct | 37 ms | 17500 KB | Correct |
4 | Correct | 26 ms | 17424 KB | Correct |
5 | Correct | 37 ms | 19036 KB | Correct |
6 | Correct | 66 ms | 19796 KB | Correct |
7 | Correct | 38 ms | 12112 KB | Correct |
8 | Correct | 47 ms | 19888 KB | Correct |
9 | Correct | 36 ms | 19796 KB | Correct |
10 | Correct | 35 ms | 19796 KB | Correct |
11 | Correct | 34 ms | 19792 KB | Correct |
12 | Incorrect | 1 ms | 4440 KB | Unexpected end of file - int32 expected |
13 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 45 ms | 19272 KB | Correct |
2 | Correct | 42 ms | 19148 KB | Correct |
3 | Correct | 37 ms | 17500 KB | Correct |
4 | Correct | 26 ms | 17424 KB | Correct |
5 | Correct | 37 ms | 19036 KB | Correct |
6 | Correct | 66 ms | 19796 KB | Correct |
7 | Correct | 38 ms | 12112 KB | Correct |
8 | Correct | 47 ms | 19888 KB | Correct |
9 | Correct | 36 ms | 19796 KB | Correct |
10 | Correct | 35 ms | 19796 KB | Correct |
11 | Correct | 34 ms | 19792 KB | Correct |
12 | Correct | 43 ms | 19284 KB | Correct |
13 | Correct | 57 ms | 19144 KB | Correct |
14 | Correct | 35 ms | 17488 KB | Correct |
15 | Correct | 28 ms | 17568 KB | Correct |
16 | Correct | 37 ms | 18884 KB | Correct |
17 | Correct | 50 ms | 19792 KB | Correct |
18 | Correct | 40 ms | 12116 KB | Correct |
19 | Correct | 34 ms | 19796 KB | Correct |
20 | Correct | 61 ms | 19796 KB | Correct |
21 | Correct | 50 ms | 19968 KB | Correct |
22 | Correct | 32 ms | 19780 KB | Correct |
23 | Correct | 44 ms | 12372 KB | Correct |
24 | Correct | 35 ms | 17776 KB | Correct |
25 | Correct | 62 ms | 12116 KB | Correct |
26 | Incorrect | 1 ms | 4440 KB | Unexpected end of file - int32 expected |
27 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 4440 KB | Correct |
2 | Incorrect | 1 ms | 4444 KB | Unexpected end of file - int32 expected |
3 | Halted | 0 ms | 0 KB | - |