# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
443415 | 2021-07-10T13:06:21 Z | leinad2 | Fountain Parks (IOI21_parks) | C++17 | 173 ms | 22028 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<=99999;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 | 62 ms | 8484 KB | Output is correct |
10 | Correct | 7 ms | 1356 KB | Output is correct |
11 | Correct | 34 ms | 4804 KB | Output is correct |
12 | Correct | 10 ms | 1740 KB | Output is correct |
13 | Correct | 15 ms | 2468 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 2 ms | 332 KB | Output is correct |
16 | Correct | 62 ms | 8116 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 | 62 ms | 8484 KB | Output is correct |
10 | Correct | 7 ms | 1356 KB | Output is correct |
11 | Correct | 34 ms | 4804 KB | Output is correct |
12 | Correct | 10 ms | 1740 KB | Output is correct |
13 | Correct | 15 ms | 2468 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 2 ms | 332 KB | Output is correct |
16 | Correct | 62 ms | 8116 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 | 304 KB | Output is correct |
22 | Correct | 1 ms | 204 KB | Output is correct |
23 | Correct | 173 ms | 22028 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 | 572 KB | Output is correct |
27 | Correct | 2 ms | 588 KB | Output is correct |
28 | Correct | 65 ms | 9084 KB | Output is correct |
29 | Correct | 98 ms | 13396 KB | Output is correct |
30 | Correct | 140 ms | 17764 KB | Output is correct |
31 | Correct | 169 ms | 22028 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 | Incorrect | 1 ms | 308 KB | Solution announced impossible, but it is possible. |
43 | 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 | 62 ms | 8484 KB | Output is correct |
10 | Correct | 7 ms | 1356 KB | Output is correct |
11 | Correct | 34 ms | 4804 KB | Output is correct |
12 | Correct | 10 ms | 1740 KB | Output is correct |
13 | Correct | 15 ms | 2468 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 2 ms | 332 KB | Output is correct |
16 | Correct | 62 ms | 8116 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 | 304 KB | Output is correct |
22 | Correct | 1 ms | 204 KB | Output is correct |
23 | Correct | 173 ms | 22028 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 | 572 KB | Output is correct |
27 | Correct | 2 ms | 588 KB | Output is correct |
28 | Correct | 65 ms | 9084 KB | Output is correct |
29 | Correct | 98 ms | 13396 KB | Output is correct |
30 | Correct | 140 ms | 17764 KB | Output is correct |
31 | Correct | 169 ms | 22028 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 | Incorrect | 1 ms | 308 KB | Solution announced impossible, but it is possible. |
43 | 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 | 62 ms | 8484 KB | Output is correct |
10 | Correct | 7 ms | 1356 KB | Output is correct |
11 | Correct | 34 ms | 4804 KB | Output is correct |
12 | Correct | 10 ms | 1740 KB | Output is correct |
13 | Correct | 15 ms | 2468 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 2 ms | 332 KB | Output is correct |
16 | Correct | 62 ms | 8116 KB | Output is correct |
17 | Runtime error | 1 ms | 384 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 | 62 ms | 8484 KB | Output is correct |
10 | Correct | 7 ms | 1356 KB | Output is correct |
11 | Correct | 34 ms | 4804 KB | Output is correct |
12 | Correct | 10 ms | 1740 KB | Output is correct |
13 | Correct | 15 ms | 2468 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 2 ms | 332 KB | Output is correct |
16 | Correct | 62 ms | 8116 KB | Output is correct |
17 | Runtime error | 50 ms | 8296 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 | 62 ms | 8484 KB | Output is correct |
10 | Correct | 7 ms | 1356 KB | Output is correct |
11 | Correct | 34 ms | 4804 KB | Output is correct |
12 | Correct | 10 ms | 1740 KB | Output is correct |
13 | Correct | 15 ms | 2468 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 2 ms | 332 KB | Output is correct |
16 | Correct | 62 ms | 8116 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 | 304 KB | Output is correct |
22 | Correct | 1 ms | 204 KB | Output is correct |
23 | Correct | 173 ms | 22028 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 | 572 KB | Output is correct |
27 | Correct | 2 ms | 588 KB | Output is correct |
28 | Correct | 65 ms | 9084 KB | Output is correct |
29 | Correct | 98 ms | 13396 KB | Output is correct |
30 | Correct | 140 ms | 17764 KB | Output is correct |
31 | Correct | 169 ms | 22028 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 | Incorrect | 1 ms | 308 KB | Solution announced impossible, but it is possible. |
43 | Halted | 0 ms | 0 KB | - |