Submission #236310

# Submission time Handle Problem Language Result Execution time Memory
236310 2020-06-01T08:20:52 Z crossing0ver Game (IOI14_game) C++17
100 / 100
485 ms 17016 KB
#include<bits/stdc++.h>
#include "game.h"
using namespace std;
 
int A[1500][1500],sz[1500],P[1500];
int par (int a) {
	return a == P[a] ? a : P[a] = par (P[a]);
}
 
int join(int a,int b) {
	int x = par(a);
	int y = par(b);
	if (x == y) return 0;
	if (A[x][y] != 1) { A[x][y]--;A[y][x]--;return 0;}
	if (sz[x] < sz[y]) swap(x,y);
	for (int i = 0; i < 1500; i++)
		if (i != x && i != y) {
			int t = A[x][i] + A[y][i];
		A[x][i] = A[i][x] = t;
	}
	P[y] = x;
	sz[x] += sz[y];
	return 1;
}
void initialize(int n) {
  for (int i = 0; i < n; i++) {
  	sz[i] = 1;
	   P[i] = i;
	  for (int j = 0;j < n; j++) {
	  	if (i != j) A[i][j] = 1;
	  } 
  }
}
 
int hasEdge(int u, int v) {
    return join(u,v);
}
# Verdict Execution time Memory Grader output
1 Correct 7 ms 6400 KB Output is correct
2 Correct 8 ms 6400 KB Output is correct
3 Correct 7 ms 6400 KB Output is correct
4 Correct 8 ms 6400 KB Output is correct
5 Correct 7 ms 6400 KB Output is correct
6 Correct 7 ms 6400 KB Output is correct
7 Correct 7 ms 6400 KB Output is correct
8 Correct 7 ms 6400 KB Output is correct
9 Correct 7 ms 6400 KB Output is correct
10 Correct 7 ms 6400 KB Output is correct
11 Correct 7 ms 6400 KB Output is correct
12 Correct 7 ms 6400 KB Output is correct
13 Correct 7 ms 6400 KB Output is correct
14 Correct 7 ms 6400 KB Output is correct
15 Correct 7 ms 6400 KB Output is correct
16 Correct 7 ms 6400 KB Output is correct
17 Correct 7 ms 6400 KB Output is correct
18 Correct 7 ms 6400 KB Output is correct
19 Correct 8 ms 6400 KB Output is correct
20 Correct 7 ms 6400 KB Output is correct
21 Correct 7 ms 6400 KB Output is correct
22 Correct 7 ms 6400 KB Output is correct
23 Correct 7 ms 6400 KB Output is correct
24 Correct 8 ms 6396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 6400 KB Output is correct
2 Correct 7 ms 6400 KB Output is correct
3 Correct 7 ms 6400 KB Output is correct
4 Correct 7 ms 6400 KB Output is correct
5 Correct 7 ms 6400 KB Output is correct
6 Correct 8 ms 6400 KB Output is correct
7 Correct 7 ms 6400 KB Output is correct
8 Correct 7 ms 6400 KB Output is correct
9 Correct 7 ms 6400 KB Output is correct
10 Correct 7 ms 6400 KB Output is correct
11 Correct 7 ms 6400 KB Output is correct
12 Correct 7 ms 6400 KB Output is correct
13 Correct 7 ms 6400 KB Output is correct
14 Correct 7 ms 6400 KB Output is correct
15 Correct 7 ms 6400 KB Output is correct
16 Correct 7 ms 6400 KB Output is correct
17 Correct 7 ms 6400 KB Output is correct
18 Correct 7 ms 6400 KB Output is correct
19 Correct 7 ms 6400 KB Output is correct
20 Correct 7 ms 6400 KB Output is correct
21 Correct 8 ms 6400 KB Output is correct
22 Correct 7 ms 6400 KB Output is correct
23 Correct 7 ms 6400 KB Output is correct
24 Correct 8 ms 6400 KB Output is correct
25 Correct 8 ms 6528 KB Output is correct
26 Correct 8 ms 6528 KB Output is correct
27 Correct 8 ms 6528 KB Output is correct
28 Correct 8 ms 6528 KB Output is correct
29 Correct 8 ms 6528 KB Output is correct
30 Correct 8 ms 6528 KB Output is correct
31 Correct 8 ms 6528 KB Output is correct
32 Correct 8 ms 6528 KB Output is correct
33 Correct 9 ms 6528 KB Output is correct
34 Correct 10 ms 6912 KB Output is correct
35 Correct 10 ms 6912 KB Output is correct
36 Correct 9 ms 6912 KB Output is correct
37 Correct 10 ms 6912 KB Output is correct
38 Correct 10 ms 6912 KB Output is correct
39 Correct 10 ms 6912 KB Output is correct
40 Correct 12 ms 6912 KB Output is correct
41 Correct 10 ms 6896 KB Output is correct
42 Correct 10 ms 6912 KB Output is correct
43 Correct 9 ms 6400 KB Output is correct
44 Correct 10 ms 6400 KB Output is correct
45 Correct 10 ms 6912 KB Output is correct
46 Correct 9 ms 7040 KB Output is correct
47 Correct 10 ms 6912 KB Output is correct
48 Correct 10 ms 6912 KB Output is correct
49 Correct 10 ms 6912 KB Output is correct
50 Correct 10 ms 6912 KB Output is correct
51 Correct 10 ms 6912 KB Output is correct
52 Correct 9 ms 6912 KB Output is correct
53 Correct 9 ms 6912 KB Output is correct
54 Correct 9 ms 6912 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 6400 KB Output is correct
2 Correct 7 ms 6400 KB Output is correct
3 Correct 7 ms 6400 KB Output is correct
4 Correct 7 ms 6400 KB Output is correct
5 Correct 8 ms 6400 KB Output is correct
6 Correct 7 ms 6400 KB Output is correct
7 Correct 7 ms 6400 KB Output is correct
8 Correct 7 ms 6400 KB Output is correct
9 Correct 7 ms 6400 KB Output is correct
10 Correct 7 ms 6400 KB Output is correct
11 Correct 7 ms 6400 KB Output is correct
12 Correct 7 ms 6400 KB Output is correct
13 Correct 7 ms 6400 KB Output is correct
14 Correct 7 ms 6400 KB Output is correct
15 Correct 7 ms 6400 KB Output is correct
16 Correct 8 ms 6400 KB Output is correct
17 Correct 7 ms 6400 KB Output is correct
18 Correct 7 ms 6400 KB Output is correct
19 Correct 7 ms 6400 KB Output is correct
20 Correct 7 ms 6400 KB Output is correct
21 Correct 7 ms 6528 KB Output is correct
22 Correct 7 ms 6400 KB Output is correct
23 Correct 7 ms 6400 KB Output is correct
24 Correct 7 ms 6400 KB Output is correct
25 Correct 8 ms 6528 KB Output is correct
26 Correct 8 ms 6528 KB Output is correct
27 Correct 8 ms 6528 KB Output is correct
28 Correct 8 ms 6528 KB Output is correct
29 Correct 8 ms 6528 KB Output is correct
30 Correct 8 ms 6528 KB Output is correct
31 Correct 9 ms 6656 KB Output is correct
32 Correct 8 ms 6528 KB Output is correct
33 Correct 8 ms 6528 KB Output is correct
34 Correct 10 ms 6912 KB Output is correct
35 Correct 10 ms 6912 KB Output is correct
36 Correct 10 ms 6912 KB Output is correct
37 Correct 10 ms 6912 KB Output is correct
38 Correct 10 ms 6912 KB Output is correct
39 Correct 10 ms 7040 KB Output is correct
40 Correct 10 ms 6912 KB Output is correct
41 Correct 10 ms 6912 KB Output is correct
42 Correct 10 ms 6912 KB Output is correct
43 Correct 9 ms 6400 KB Output is correct
44 Correct 9 ms 6400 KB Output is correct
45 Correct 10 ms 6912 KB Output is correct
46 Correct 10 ms 6912 KB Output is correct
47 Correct 10 ms 6912 KB Output is correct
48 Correct 10 ms 6912 KB Output is correct
49 Correct 10 ms 6912 KB Output is correct
50 Correct 10 ms 6912 KB Output is correct
51 Correct 10 ms 6912 KB Output is correct
52 Correct 11 ms 6912 KB Output is correct
53 Correct 10 ms 6912 KB Output is correct
54 Correct 10 ms 6912 KB Output is correct
55 Correct 64 ms 10872 KB Output is correct
56 Correct 65 ms 10872 KB Output is correct
57 Correct 62 ms 11000 KB Output is correct
58 Correct 62 ms 10872 KB Output is correct
59 Correct 61 ms 10872 KB Output is correct
60 Correct 61 ms 10872 KB Output is correct
61 Correct 62 ms 10872 KB Output is correct
62 Correct 61 ms 10872 KB Output is correct
63 Correct 77 ms 10936 KB Output is correct
64 Correct 58 ms 9080 KB Output is correct
65 Correct 57 ms 9208 KB Output is correct
66 Correct 62 ms 10848 KB Output is correct
67 Correct 61 ms 10896 KB Output is correct
68 Correct 62 ms 10872 KB Output is correct
69 Correct 62 ms 10872 KB Output is correct
70 Correct 66 ms 11000 KB Output is correct
71 Correct 59 ms 10872 KB Output is correct
72 Correct 63 ms 10872 KB Output is correct
73 Correct 62 ms 10872 KB Output is correct
74 Correct 64 ms 11000 KB Output is correct
75 Correct 60 ms 10872 KB Output is correct
76 Correct 125 ms 12024 KB Output is correct
77 Correct 122 ms 12024 KB Output is correct
78 Correct 125 ms 12024 KB Output is correct
79 Correct 121 ms 12024 KB Output is correct
80 Correct 125 ms 12024 KB Output is correct
81 Correct 125 ms 12024 KB Output is correct
82 Correct 121 ms 12024 KB Output is correct
83 Correct 128 ms 12152 KB Output is correct
84 Correct 129 ms 12024 KB Output is correct
85 Correct 214 ms 13304 KB Output is correct
86 Correct 215 ms 13304 KB Output is correct
87 Correct 217 ms 13304 KB Output is correct
88 Correct 208 ms 13304 KB Output is correct
89 Correct 213 ms 13304 KB Output is correct
90 Correct 212 ms 13304 KB Output is correct
91 Correct 223 ms 13452 KB Output is correct
92 Correct 203 ms 13308 KB Output is correct
93 Correct 213 ms 13304 KB Output is correct
94 Correct 485 ms 16836 KB Output is correct
95 Correct 453 ms 16888 KB Output is correct
96 Correct 457 ms 16928 KB Output is correct
97 Correct 477 ms 17016 KB Output is correct
98 Correct 449 ms 16856 KB Output is correct
99 Correct 460 ms 16888 KB Output is correct
100 Correct 456 ms 17016 KB Output is correct