# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1057860 | 2024-08-14T06:53:52 Z | 김은성(#11075) | Telephone Plans (CCO24_day2problem3) | C++17 | 17 ms | 24408 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; vector<int> graph[500009]; int idx[209][39]; void dfs(int q, int v, int id){ idx[q][v] = id; for(int u: graph[v]){ if(!idx[q][u]) dfs(q, u, id); } } int main(){ int e, n, q, i, type; ll x, y, t, lastans = 0; scanf("%d", &e); scanf("%d %d", &n, &q); assert(n <= 30); for(i=1; i<=q; i++){ scanf("%d", &type); if(type == 1){ scanf("%lld %lld", &x, &y); if(e){ x ^= lastans; y ^= lastans; } graph[x].push_back(y); graph[y].push_back(x); } else if(type == 2){ scanf("%lld %lld", &x, &y); if(e){ x ^= lastans; y ^= lastans; } graph[x].erase(find(graph[x].begin(), graph[x].end(), y)); graph[y].erase(find(graph[y].begin(), graph[y].end(), x)); } else{ int cnt = 0; for(int j=1; j<=n;j++){ if(!idx[i][j]) dfs(i, j, ++cnt); } scanf("%lld", &t); if(e){ t ^= lastans; } lastans = 0; for(int u = 1; u<=n; u++){ for(int v=u+1; v<=n; v++){ bool flag = 0; for(int k = i-t; k <= i; k++){ if(idx[k][u] == idx[k][v]) flag = 1; } if(flag) lastans++; } } printf("%lld\n", lastans); } int cnt = 0; for(int j=1; j<=n;j++){ if(!idx[i][j]) dfs(i, j, ++cnt); } } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 12124 KB | Output is correct |
2 | Correct | 2 ms | 12184 KB | Output is correct |
3 | Correct | 3 ms | 12124 KB | Output is correct |
4 | Correct | 3 ms | 12124 KB | Output is correct |
5 | Correct | 3 ms | 12124 KB | Output is correct |
6 | Correct | 3 ms | 12188 KB | Output is correct |
7 | Correct | 3 ms | 12192 KB | Output is correct |
8 | Correct | 3 ms | 12124 KB | Output is correct |
9 | Correct | 3 ms | 12124 KB | Output is correct |
10 | Correct | 3 ms | 12124 KB | Output is correct |
11 | Correct | 3 ms | 12124 KB | Output is correct |
12 | Correct | 2 ms | 12124 KB | Output is correct |
13 | Correct | 3 ms | 12124 KB | Output is correct |
14 | Correct | 3 ms | 12120 KB | Output is correct |
15 | Correct | 3 ms | 12124 KB | Output is correct |
16 | Correct | 3 ms | 12124 KB | Output is correct |
17 | Correct | 3 ms | 12124 KB | Output is correct |
18 | Correct | 3 ms | 12196 KB | Output is correct |
19 | Correct | 3 ms | 12124 KB | Output is correct |
20 | Correct | 3 ms | 12120 KB | Output is correct |
21 | Correct | 3 ms | 12124 KB | Output is correct |
22 | Correct | 3 ms | 12124 KB | Output is correct |
23 | Correct | 3 ms | 12188 KB | Output is correct |
24 | Correct | 3 ms | 12124 KB | Output is correct |
25 | Correct | 3 ms | 12124 KB | Output is correct |
26 | Correct | 3 ms | 12124 KB | Output is correct |
27 | Correct | 4 ms | 12124 KB | Output is correct |
28 | Correct | 3 ms | 12124 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 12124 KB | Output is correct |
2 | Correct | 2 ms | 12124 KB | Output is correct |
3 | Correct | 3 ms | 12124 KB | Output is correct |
4 | Correct | 3 ms | 12124 KB | Output is correct |
5 | Correct | 3 ms | 12124 KB | Output is correct |
6 | Correct | 3 ms | 12112 KB | Output is correct |
7 | Correct | 4 ms | 12124 KB | Output is correct |
8 | Correct | 3 ms | 12124 KB | Output is correct |
9 | Correct | 3 ms | 12108 KB | Output is correct |
10 | Correct | 3 ms | 12124 KB | Output is correct |
11 | Correct | 3 ms | 12120 KB | Output is correct |
12 | Correct | 3 ms | 12124 KB | Output is correct |
13 | Correct | 3 ms | 12124 KB | Output is correct |
14 | Correct | 3 ms | 12124 KB | Output is correct |
15 | Correct | 3 ms | 12124 KB | Output is correct |
16 | Correct | 3 ms | 12124 KB | Output is correct |
17 | Correct | 3 ms | 12124 KB | Output is correct |
18 | Correct | 3 ms | 12124 KB | Output is correct |
19 | Correct | 3 ms | 12124 KB | Output is correct |
20 | Correct | 3 ms | 12124 KB | Output is correct |
21 | Correct | 3 ms | 12124 KB | Output is correct |
22 | Correct | 3 ms | 12124 KB | Output is correct |
23 | Correct | 3 ms | 12124 KB | Output is correct |
24 | Correct | 3 ms | 12208 KB | Output is correct |
25 | Correct | 2 ms | 12124 KB | Output is correct |
26 | Correct | 3 ms | 12124 KB | Output is correct |
27 | Correct | 3 ms | 12124 KB | Output is correct |
28 | Correct | 3 ms | 12124 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 12124 KB | Output is correct |
2 | Correct | 2 ms | 12184 KB | Output is correct |
3 | Correct | 3 ms | 12124 KB | Output is correct |
4 | Correct | 3 ms | 12124 KB | Output is correct |
5 | Correct | 3 ms | 12124 KB | Output is correct |
6 | Correct | 3 ms | 12188 KB | Output is correct |
7 | Correct | 3 ms | 12192 KB | Output is correct |
8 | Correct | 3 ms | 12124 KB | Output is correct |
9 | Correct | 3 ms | 12124 KB | Output is correct |
10 | Correct | 3 ms | 12124 KB | Output is correct |
11 | Correct | 3 ms | 12124 KB | Output is correct |
12 | Correct | 2 ms | 12124 KB | Output is correct |
13 | Correct | 3 ms | 12124 KB | Output is correct |
14 | Correct | 3 ms | 12120 KB | Output is correct |
15 | Correct | 3 ms | 12124 KB | Output is correct |
16 | Correct | 3 ms | 12124 KB | Output is correct |
17 | Correct | 3 ms | 12124 KB | Output is correct |
18 | Correct | 3 ms | 12196 KB | Output is correct |
19 | Correct | 3 ms | 12124 KB | Output is correct |
20 | Correct | 3 ms | 12120 KB | Output is correct |
21 | Correct | 3 ms | 12124 KB | Output is correct |
22 | Correct | 3 ms | 12124 KB | Output is correct |
23 | Correct | 3 ms | 12188 KB | Output is correct |
24 | Correct | 3 ms | 12124 KB | Output is correct |
25 | Correct | 3 ms | 12124 KB | Output is correct |
26 | Correct | 3 ms | 12124 KB | Output is correct |
27 | Correct | 4 ms | 12124 KB | Output is correct |
28 | Correct | 3 ms | 12124 KB | Output is correct |
29 | Runtime error | 17 ms | 24408 KB | Execution killed with signal 6 |
30 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 12124 KB | Output is correct |
2 | Correct | 2 ms | 12124 KB | Output is correct |
3 | Correct | 3 ms | 12124 KB | Output is correct |
4 | Correct | 3 ms | 12124 KB | Output is correct |
5 | Correct | 3 ms | 12124 KB | Output is correct |
6 | Correct | 3 ms | 12112 KB | Output is correct |
7 | Correct | 4 ms | 12124 KB | Output is correct |
8 | Correct | 3 ms | 12124 KB | Output is correct |
9 | Correct | 3 ms | 12108 KB | Output is correct |
10 | Correct | 3 ms | 12124 KB | Output is correct |
11 | Correct | 3 ms | 12120 KB | Output is correct |
12 | Correct | 3 ms | 12124 KB | Output is correct |
13 | Correct | 3 ms | 12124 KB | Output is correct |
14 | Correct | 3 ms | 12124 KB | Output is correct |
15 | Correct | 3 ms | 12124 KB | Output is correct |
16 | Correct | 3 ms | 12124 KB | Output is correct |
17 | Correct | 3 ms | 12124 KB | Output is correct |
18 | Correct | 3 ms | 12124 KB | Output is correct |
19 | Correct | 3 ms | 12124 KB | Output is correct |
20 | Correct | 3 ms | 12124 KB | Output is correct |
21 | Correct | 3 ms | 12124 KB | Output is correct |
22 | Correct | 3 ms | 12124 KB | Output is correct |
23 | Correct | 3 ms | 12124 KB | Output is correct |
24 | Correct | 3 ms | 12208 KB | Output is correct |
25 | Correct | 2 ms | 12124 KB | Output is correct |
26 | Correct | 3 ms | 12124 KB | Output is correct |
27 | Correct | 3 ms | 12124 KB | Output is correct |
28 | Correct | 3 ms | 12124 KB | Output is correct |
29 | Runtime error | 14 ms | 24248 KB | Execution killed with signal 6 |
30 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 12124 KB | Output is correct |
2 | Correct | 2 ms | 12184 KB | Output is correct |
3 | Correct | 3 ms | 12124 KB | Output is correct |
4 | Correct | 3 ms | 12124 KB | Output is correct |
5 | Correct | 3 ms | 12124 KB | Output is correct |
6 | Correct | 3 ms | 12188 KB | Output is correct |
7 | Correct | 3 ms | 12192 KB | Output is correct |
8 | Correct | 3 ms | 12124 KB | Output is correct |
9 | Correct | 3 ms | 12124 KB | Output is correct |
10 | Correct | 3 ms | 12124 KB | Output is correct |
11 | Correct | 3 ms | 12124 KB | Output is correct |
12 | Correct | 2 ms | 12124 KB | Output is correct |
13 | Correct | 3 ms | 12124 KB | Output is correct |
14 | Correct | 3 ms | 12120 KB | Output is correct |
15 | Correct | 3 ms | 12124 KB | Output is correct |
16 | Correct | 3 ms | 12124 KB | Output is correct |
17 | Correct | 3 ms | 12124 KB | Output is correct |
18 | Correct | 3 ms | 12196 KB | Output is correct |
19 | Correct | 3 ms | 12124 KB | Output is correct |
20 | Correct | 3 ms | 12120 KB | Output is correct |
21 | Correct | 3 ms | 12124 KB | Output is correct |
22 | Correct | 3 ms | 12124 KB | Output is correct |
23 | Correct | 3 ms | 12188 KB | Output is correct |
24 | Correct | 3 ms | 12124 KB | Output is correct |
25 | Correct | 3 ms | 12124 KB | Output is correct |
26 | Correct | 3 ms | 12124 KB | Output is correct |
27 | Correct | 4 ms | 12124 KB | Output is correct |
28 | Correct | 3 ms | 12124 KB | Output is correct |
29 | Runtime error | 17 ms | 24408 KB | Execution killed with signal 6 |
30 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 12124 KB | Output is correct |
2 | Correct | 2 ms | 12124 KB | Output is correct |
3 | Correct | 3 ms | 12124 KB | Output is correct |
4 | Correct | 3 ms | 12124 KB | Output is correct |
5 | Correct | 3 ms | 12124 KB | Output is correct |
6 | Correct | 3 ms | 12112 KB | Output is correct |
7 | Correct | 4 ms | 12124 KB | Output is correct |
8 | Correct | 3 ms | 12124 KB | Output is correct |
9 | Correct | 3 ms | 12108 KB | Output is correct |
10 | Correct | 3 ms | 12124 KB | Output is correct |
11 | Correct | 3 ms | 12120 KB | Output is correct |
12 | Correct | 3 ms | 12124 KB | Output is correct |
13 | Correct | 3 ms | 12124 KB | Output is correct |
14 | Correct | 3 ms | 12124 KB | Output is correct |
15 | Correct | 3 ms | 12124 KB | Output is correct |
16 | Correct | 3 ms | 12124 KB | Output is correct |
17 | Correct | 3 ms | 12124 KB | Output is correct |
18 | Correct | 3 ms | 12124 KB | Output is correct |
19 | Correct | 3 ms | 12124 KB | Output is correct |
20 | Correct | 3 ms | 12124 KB | Output is correct |
21 | Correct | 3 ms | 12124 KB | Output is correct |
22 | Correct | 3 ms | 12124 KB | Output is correct |
23 | Correct | 3 ms | 12124 KB | Output is correct |
24 | Correct | 3 ms | 12208 KB | Output is correct |
25 | Correct | 2 ms | 12124 KB | Output is correct |
26 | Correct | 3 ms | 12124 KB | Output is correct |
27 | Correct | 3 ms | 12124 KB | Output is correct |
28 | Correct | 3 ms | 12124 KB | Output is correct |
29 | Runtime error | 14 ms | 24248 KB | Execution killed with signal 6 |
30 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 12124 KB | Output is correct |
2 | Correct | 2 ms | 12124 KB | Output is correct |
3 | Correct | 3 ms | 12124 KB | Output is correct |
4 | Correct | 3 ms | 12124 KB | Output is correct |
5 | Correct | 3 ms | 12124 KB | Output is correct |
6 | Correct | 3 ms | 12112 KB | Output is correct |
7 | Correct | 4 ms | 12124 KB | Output is correct |
8 | Correct | 3 ms | 12124 KB | Output is correct |
9 | Correct | 3 ms | 12108 KB | Output is correct |
10 | Correct | 3 ms | 12124 KB | Output is correct |
11 | Correct | 3 ms | 12120 KB | Output is correct |
12 | Correct | 3 ms | 12124 KB | Output is correct |
13 | Correct | 3 ms | 12124 KB | Output is correct |
14 | Correct | 3 ms | 12124 KB | Output is correct |
15 | Correct | 3 ms | 12124 KB | Output is correct |
16 | Correct | 3 ms | 12124 KB | Output is correct |
17 | Correct | 3 ms | 12124 KB | Output is correct |
18 | Correct | 3 ms | 12124 KB | Output is correct |
19 | Correct | 3 ms | 12124 KB | Output is correct |
20 | Correct | 3 ms | 12124 KB | Output is correct |
21 | Correct | 3 ms | 12124 KB | Output is correct |
22 | Correct | 3 ms | 12124 KB | Output is correct |
23 | Correct | 3 ms | 12124 KB | Output is correct |
24 | Correct | 3 ms | 12208 KB | Output is correct |
25 | Correct | 2 ms | 12124 KB | Output is correct |
26 | Correct | 3 ms | 12124 KB | Output is correct |
27 | Correct | 3 ms | 12124 KB | Output is correct |
28 | Correct | 3 ms | 12124 KB | Output is correct |
29 | Runtime error | 14 ms | 24248 KB | Execution killed with signal 6 |
30 | Halted | 0 ms | 0 KB | - |