#include "game.h"
const int N = 1.5e3 + 10;
int rq[N][N], p[N], n;
int gp(int x){
return p[x]==x ? x : p[x]=gp(p[x]);
}
void uni(int x, int y){
p[y] = x;
for(int i = 0; i < n; i++){
rq[i][x] += rq[i][y];
rq[i][y] = 0;
rq[x][i] += rq[y][i];
}
}
void initialize(int wtn) {
n = wtn;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
rq[i][j] = 1;
}
rq[i][i] = 0;
p[i] = i;
}
}
int hasEdge(int u, int v) {
u = gp(u);
v = gp(v);
rq[v][u]--;
rq[u][v]--;
if(!rq[u][v]){
uni(u, v);
return 1;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
1 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
23 |
Correct |
1 ms |
212 KB |
Output is correct |
24 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
1 ms |
212 KB |
Output is correct |
21 |
Correct |
1 ms |
212 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
23 |
Correct |
0 ms |
212 KB |
Output is correct |
24 |
Correct |
0 ms |
212 KB |
Output is correct |
25 |
Correct |
0 ms |
340 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
0 ms |
340 KB |
Output is correct |
28 |
Correct |
1 ms |
340 KB |
Output is correct |
29 |
Correct |
1 ms |
340 KB |
Output is correct |
30 |
Correct |
1 ms |
340 KB |
Output is correct |
31 |
Correct |
1 ms |
340 KB |
Output is correct |
32 |
Correct |
1 ms |
340 KB |
Output is correct |
33 |
Correct |
1 ms |
340 KB |
Output is correct |
34 |
Correct |
1 ms |
596 KB |
Output is correct |
35 |
Correct |
2 ms |
596 KB |
Output is correct |
36 |
Correct |
2 ms |
596 KB |
Output is correct |
37 |
Correct |
2 ms |
596 KB |
Output is correct |
38 |
Correct |
1 ms |
596 KB |
Output is correct |
39 |
Correct |
1 ms |
596 KB |
Output is correct |
40 |
Correct |
1 ms |
596 KB |
Output is correct |
41 |
Correct |
1 ms |
596 KB |
Output is correct |
42 |
Correct |
1 ms |
596 KB |
Output is correct |
43 |
Correct |
1 ms |
596 KB |
Output is correct |
44 |
Correct |
1 ms |
596 KB |
Output is correct |
45 |
Correct |
1 ms |
596 KB |
Output is correct |
46 |
Correct |
1 ms |
596 KB |
Output is correct |
47 |
Correct |
1 ms |
596 KB |
Output is correct |
48 |
Correct |
1 ms |
596 KB |
Output is correct |
49 |
Correct |
2 ms |
596 KB |
Output is correct |
50 |
Correct |
1 ms |
596 KB |
Output is correct |
51 |
Correct |
1 ms |
596 KB |
Output is correct |
52 |
Correct |
1 ms |
596 KB |
Output is correct |
53 |
Correct |
1 ms |
596 KB |
Output is correct |
54 |
Correct |
1 ms |
596 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
0 ms |
212 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
0 ms |
212 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
23 |
Correct |
0 ms |
212 KB |
Output is correct |
24 |
Correct |
0 ms |
212 KB |
Output is correct |
25 |
Correct |
1 ms |
340 KB |
Output is correct |
26 |
Correct |
1 ms |
340 KB |
Output is correct |
27 |
Correct |
1 ms |
340 KB |
Output is correct |
28 |
Correct |
1 ms |
340 KB |
Output is correct |
29 |
Correct |
0 ms |
340 KB |
Output is correct |
30 |
Correct |
0 ms |
340 KB |
Output is correct |
31 |
Correct |
1 ms |
340 KB |
Output is correct |
32 |
Correct |
0 ms |
340 KB |
Output is correct |
33 |
Correct |
1 ms |
340 KB |
Output is correct |
34 |
Correct |
1 ms |
596 KB |
Output is correct |
35 |
Correct |
1 ms |
596 KB |
Output is correct |
36 |
Correct |
1 ms |
596 KB |
Output is correct |
37 |
Correct |
1 ms |
596 KB |
Output is correct |
38 |
Correct |
1 ms |
596 KB |
Output is correct |
39 |
Correct |
1 ms |
596 KB |
Output is correct |
40 |
Correct |
2 ms |
596 KB |
Output is correct |
41 |
Correct |
1 ms |
596 KB |
Output is correct |
42 |
Correct |
1 ms |
596 KB |
Output is correct |
43 |
Correct |
1 ms |
596 KB |
Output is correct |
44 |
Correct |
1 ms |
596 KB |
Output is correct |
45 |
Correct |
1 ms |
596 KB |
Output is correct |
46 |
Correct |
1 ms |
596 KB |
Output is correct |
47 |
Correct |
1 ms |
596 KB |
Output is correct |
48 |
Correct |
1 ms |
596 KB |
Output is correct |
49 |
Correct |
1 ms |
596 KB |
Output is correct |
50 |
Correct |
1 ms |
596 KB |
Output is correct |
51 |
Correct |
1 ms |
596 KB |
Output is correct |
52 |
Correct |
1 ms |
596 KB |
Output is correct |
53 |
Correct |
1 ms |
596 KB |
Output is correct |
54 |
Correct |
1 ms |
596 KB |
Output is correct |
55 |
Correct |
32 ms |
4080 KB |
Output is correct |
56 |
Correct |
33 ms |
4052 KB |
Output is correct |
57 |
Correct |
32 ms |
4076 KB |
Output is correct |
58 |
Correct |
30 ms |
4052 KB |
Output is correct |
59 |
Correct |
36 ms |
4048 KB |
Output is correct |
60 |
Correct |
41 ms |
4044 KB |
Output is correct |
61 |
Correct |
35 ms |
4076 KB |
Output is correct |
62 |
Correct |
36 ms |
4044 KB |
Output is correct |
63 |
Correct |
48 ms |
3980 KB |
Output is correct |
64 |
Correct |
64 ms |
4000 KB |
Output is correct |
65 |
Correct |
52 ms |
4072 KB |
Output is correct |
66 |
Correct |
48 ms |
3992 KB |
Output is correct |
67 |
Correct |
34 ms |
4032 KB |
Output is correct |
68 |
Correct |
37 ms |
3992 KB |
Output is correct |
69 |
Correct |
53 ms |
3988 KB |
Output is correct |
70 |
Correct |
41 ms |
4048 KB |
Output is correct |
71 |
Correct |
81 ms |
4080 KB |
Output is correct |
72 |
Correct |
49 ms |
4092 KB |
Output is correct |
73 |
Correct |
56 ms |
4092 KB |
Output is correct |
74 |
Correct |
35 ms |
4084 KB |
Output is correct |
75 |
Correct |
57 ms |
4044 KB |
Output is correct |
76 |
Correct |
104 ms |
6644 KB |
Output is correct |
77 |
Correct |
107 ms |
6640 KB |
Output is correct |
78 |
Correct |
84 ms |
6648 KB |
Output is correct |
79 |
Correct |
83 ms |
6552 KB |
Output is correct |
80 |
Correct |
101 ms |
6600 KB |
Output is correct |
81 |
Correct |
98 ms |
6528 KB |
Output is correct |
82 |
Correct |
101 ms |
6576 KB |
Output is correct |
83 |
Correct |
99 ms |
6596 KB |
Output is correct |
84 |
Correct |
104 ms |
6608 KB |
Output is correct |
85 |
Correct |
176 ms |
9324 KB |
Output is correct |
86 |
Correct |
169 ms |
9424 KB |
Output is correct |
87 |
Correct |
150 ms |
9452 KB |
Output is correct |
88 |
Correct |
155 ms |
9348 KB |
Output is correct |
89 |
Correct |
134 ms |
9328 KB |
Output is correct |
90 |
Correct |
137 ms |
9328 KB |
Output is correct |
91 |
Correct |
157 ms |
9448 KB |
Output is correct |
92 |
Correct |
133 ms |
9344 KB |
Output is correct |
93 |
Correct |
146 ms |
9416 KB |
Output is correct |
94 |
Correct |
330 ms |
15732 KB |
Output is correct |
95 |
Correct |
393 ms |
15776 KB |
Output is correct |
96 |
Correct |
385 ms |
15820 KB |
Output is correct |
97 |
Correct |
321 ms |
15716 KB |
Output is correct |
98 |
Correct |
311 ms |
15692 KB |
Output is correct |
99 |
Correct |
301 ms |
15740 KB |
Output is correct |
100 |
Correct |
296 ms |
15784 KB |
Output is correct |