# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
443420 | 2021-07-10T13:07:59 Z | leinad2 | Fountain Parks (IOI21_parks) | C++17 | 199 ms | 20368 KB |
#include "parks.h" #include<bits/stdc++.h> using namespace std; int par[200010], A[3][100010]; int Find(int v){return v==par[v]?v:par[v]=Find(par[v]);} int construct_roads(vector<int>x, vector<int>y) { int n, i, j, k;n=x.size(); for(i=0;i<n;i++)par[i]=i; for(i=0;i<n;i++)A[x[i]/2][y[i]/2]=i+1; vector<int>u, v, a, b; for(i=1;i<=2;i++) { for(j=1;j<=99999;j++) { if(A[i][j]&&A[i][j+1]) { int x=A[i][j]-1;int y=A[i][j+1]-1; u.push_back(x); v.push_back(y); a.push_back(4*i-3); b.push_back(2*j+1); par[Find(x)]=Find(y); } } } for(j=1;j<=100000;j++) { if(A[1][j]&&A[2][j]) { int x=A[1][j]-1;int y=A[2][j]-1; u.push_back(x); v.push_back(y); a.push_back(3); b.push_back(2*j+1); par[Find(x)]=Find(y); } } for(i=1;i<n;i++)if(Find(i)!=Find(0))return 0; build(u, v, a, b); return 1; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 63 ms | 8492 KB | Output is correct |
10 | Correct | 6 ms | 1356 KB | Output is correct |
11 | Correct | 32 ms | 4824 KB | Output is correct |
12 | Correct | 9 ms | 1740 KB | Output is correct |
13 | Correct | 11 ms | 2500 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 1 ms | 332 KB | Output is correct |
16 | Correct | 67 ms | 8236 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 63 ms | 8492 KB | Output is correct |
10 | Correct | 6 ms | 1356 KB | Output is correct |
11 | Correct | 32 ms | 4824 KB | Output is correct |
12 | Correct | 9 ms | 1740 KB | Output is correct |
13 | Correct | 11 ms | 2500 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 1 ms | 332 KB | Output is correct |
16 | Correct | 67 ms | 8236 KB | Output is correct |
17 | Correct | 1 ms | 204 KB | Output is correct |
18 | Correct | 1 ms | 204 KB | Output is correct |
19 | Correct | 1 ms | 204 KB | Output is correct |
20 | Correct | 1 ms | 204 KB | Output is correct |
21 | Correct | 1 ms | 204 KB | Output is correct |
22 | Correct | 1 ms | 204 KB | Output is correct |
23 | Correct | 197 ms | 20352 KB | Output is correct |
24 | Correct | 1 ms | 204 KB | Output is correct |
25 | Correct | 2 ms | 460 KB | Output is correct |
26 | Correct | 2 ms | 460 KB | Output is correct |
27 | Correct | 2 ms | 588 KB | Output is correct |
28 | Correct | 64 ms | 8472 KB | Output is correct |
29 | Correct | 98 ms | 12424 KB | Output is correct |
30 | Correct | 131 ms | 16368 KB | Output is correct |
31 | Correct | 199 ms | 20368 KB | Output is correct |
32 | Correct | 1 ms | 204 KB | Output is correct |
33 | Correct | 1 ms | 204 KB | Output is correct |
34 | Correct | 1 ms | 204 KB | Output is correct |
35 | Correct | 1 ms | 204 KB | Output is correct |
36 | Correct | 1 ms | 204 KB | Output is correct |
37 | Correct | 1 ms | 204 KB | Output is correct |
38 | Correct | 1 ms | 204 KB | Output is correct |
39 | Correct | 1 ms | 204 KB | Output is correct |
40 | Correct | 1 ms | 204 KB | Output is correct |
41 | Correct | 1 ms | 204 KB | Output is correct |
42 | Correct | 3 ms | 204 KB | Output is correct |
43 | Correct | 1 ms | 332 KB | Output is correct |
44 | Correct | 2 ms | 460 KB | Output is correct |
45 | Correct | 62 ms | 8476 KB | Output is correct |
46 | Correct | 95 ms | 12264 KB | Output is correct |
47 | Correct | 100 ms | 12160 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 63 ms | 8492 KB | Output is correct |
10 | Correct | 6 ms | 1356 KB | Output is correct |
11 | Correct | 32 ms | 4824 KB | Output is correct |
12 | Correct | 9 ms | 1740 KB | Output is correct |
13 | Correct | 11 ms | 2500 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 1 ms | 332 KB | Output is correct |
16 | Correct | 67 ms | 8236 KB | Output is correct |
17 | Correct | 1 ms | 204 KB | Output is correct |
18 | Correct | 1 ms | 204 KB | Output is correct |
19 | Correct | 1 ms | 204 KB | Output is correct |
20 | Correct | 1 ms | 204 KB | Output is correct |
21 | Correct | 1 ms | 204 KB | Output is correct |
22 | Correct | 1 ms | 204 KB | Output is correct |
23 | Correct | 197 ms | 20352 KB | Output is correct |
24 | Correct | 1 ms | 204 KB | Output is correct |
25 | Correct | 2 ms | 460 KB | Output is correct |
26 | Correct | 2 ms | 460 KB | Output is correct |
27 | Correct | 2 ms | 588 KB | Output is correct |
28 | Correct | 64 ms | 8472 KB | Output is correct |
29 | Correct | 98 ms | 12424 KB | Output is correct |
30 | Correct | 131 ms | 16368 KB | Output is correct |
31 | Correct | 199 ms | 20368 KB | Output is correct |
32 | Correct | 1 ms | 204 KB | Output is correct |
33 | Correct | 1 ms | 204 KB | Output is correct |
34 | Correct | 1 ms | 204 KB | Output is correct |
35 | Correct | 1 ms | 204 KB | Output is correct |
36 | Correct | 1 ms | 204 KB | Output is correct |
37 | Correct | 1 ms | 204 KB | Output is correct |
38 | Correct | 1 ms | 204 KB | Output is correct |
39 | Correct | 1 ms | 204 KB | Output is correct |
40 | Correct | 1 ms | 204 KB | Output is correct |
41 | Correct | 1 ms | 204 KB | Output is correct |
42 | Correct | 3 ms | 204 KB | Output is correct |
43 | Correct | 1 ms | 332 KB | Output is correct |
44 | Correct | 2 ms | 460 KB | Output is correct |
45 | Correct | 62 ms | 8476 KB | Output is correct |
46 | Correct | 95 ms | 12264 KB | Output is correct |
47 | Correct | 100 ms | 12160 KB | Output is correct |
48 | Incorrect | 1 ms | 204 KB | Solution announced impossible, but it is possible. |
49 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 63 ms | 8492 KB | Output is correct |
10 | Correct | 6 ms | 1356 KB | Output is correct |
11 | Correct | 32 ms | 4824 KB | Output is correct |
12 | Correct | 9 ms | 1740 KB | Output is correct |
13 | Correct | 11 ms | 2500 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 1 ms | 332 KB | Output is correct |
16 | Correct | 67 ms | 8236 KB | Output is correct |
17 | Runtime error | 1 ms | 332 KB | Execution killed with signal 11 |
18 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 63 ms | 8492 KB | Output is correct |
10 | Correct | 6 ms | 1356 KB | Output is correct |
11 | Correct | 32 ms | 4824 KB | Output is correct |
12 | Correct | 9 ms | 1740 KB | Output is correct |
13 | Correct | 11 ms | 2500 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 1 ms | 332 KB | Output is correct |
16 | Correct | 67 ms | 8236 KB | Output is correct |
17 | Runtime error | 50 ms | 8316 KB | Execution killed with signal 11 |
18 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 63 ms | 8492 KB | Output is correct |
10 | Correct | 6 ms | 1356 KB | Output is correct |
11 | Correct | 32 ms | 4824 KB | Output is correct |
12 | Correct | 9 ms | 1740 KB | Output is correct |
13 | Correct | 11 ms | 2500 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 1 ms | 332 KB | Output is correct |
16 | Correct | 67 ms | 8236 KB | Output is correct |
17 | Correct | 1 ms | 204 KB | Output is correct |
18 | Correct | 1 ms | 204 KB | Output is correct |
19 | Correct | 1 ms | 204 KB | Output is correct |
20 | Correct | 1 ms | 204 KB | Output is correct |
21 | Correct | 1 ms | 204 KB | Output is correct |
22 | Correct | 1 ms | 204 KB | Output is correct |
23 | Correct | 197 ms | 20352 KB | Output is correct |
24 | Correct | 1 ms | 204 KB | Output is correct |
25 | Correct | 2 ms | 460 KB | Output is correct |
26 | Correct | 2 ms | 460 KB | Output is correct |
27 | Correct | 2 ms | 588 KB | Output is correct |
28 | Correct | 64 ms | 8472 KB | Output is correct |
29 | Correct | 98 ms | 12424 KB | Output is correct |
30 | Correct | 131 ms | 16368 KB | Output is correct |
31 | Correct | 199 ms | 20368 KB | Output is correct |
32 | Correct | 1 ms | 204 KB | Output is correct |
33 | Correct | 1 ms | 204 KB | Output is correct |
34 | Correct | 1 ms | 204 KB | Output is correct |
35 | Correct | 1 ms | 204 KB | Output is correct |
36 | Correct | 1 ms | 204 KB | Output is correct |
37 | Correct | 1 ms | 204 KB | Output is correct |
38 | Correct | 1 ms | 204 KB | Output is correct |
39 | Correct | 1 ms | 204 KB | Output is correct |
40 | Correct | 1 ms | 204 KB | Output is correct |
41 | Correct | 1 ms | 204 KB | Output is correct |
42 | Correct | 3 ms | 204 KB | Output is correct |
43 | Correct | 1 ms | 332 KB | Output is correct |
44 | Correct | 2 ms | 460 KB | Output is correct |
45 | Correct | 62 ms | 8476 KB | Output is correct |
46 | Correct | 95 ms | 12264 KB | Output is correct |
47 | Correct | 100 ms | 12160 KB | Output is correct |
48 | Incorrect | 1 ms | 204 KB | Solution announced impossible, but it is possible. |
49 | Halted | 0 ms | 0 KB | - |