Submission #554369

# Submission time Handle Problem Language Result Execution time Memory
554369 2022-04-28T09:29:52 Z Koosha_mv Game (IOI14_game) C++14
100 / 100
348 ms 15852 KB
#include <bits/stdc++.h>
using namespace std;
#define dbgv(v) cout<<#v<<" = "; f(i,0,v.size()) cout<<v[i]<<" "; cout<<endl
#define dbga(a,x,y) cout<<#a<<" = "; f(i,x,y) cout<<a[i]<<" "; cout<<endl
#define erorp(x) cout<<#x<<"={"<<x.F<<" , "<<x.S<<"}"<<endl
#define eror(x) cout<<#x<<'='<<(x)<<endl
#define f_(i,a,b) for(int i=a;i>=b;i--)
#define f(i,a,b) for(int i=a;i<b;i++)
#define nb(x) __builtin_popcount(x)
#define all(v) v.begin(),v.end()
#define bit(n,k) (((n)>>(k))&1)
#define Add(x,y) x=(x+y)%mod
#define maxm(a,b) a=max(a,b)
#define minm(a,b) a=min(a,b)
#define lst(x) x[x.size()-1]
#define sz(x) int(x.size())
#define mp make_pair
#define ll long long
#define pb push_back
#define S second
#define F first
#include "game.h"

const int N=1505;

int n,t,a[N],sz[N],col[N],g[N][N];

void initialize(int _n){
	n=_n;
	f(i,1,n+1) col[i]=i,sz[i]=1;
}
int hasEdge(int u, int v){
	u++,v++;
	if(g[col[u]][col[v]]+1==sz[col[u]]*sz[col[v]]){
		f(i,1,n+1) g[col[u]][i]+=g[col[v]][i],g[i][col[u]]+=g[i][col[v]];
		int cl=col[v];
		f(i,1,n+1) if(col[i]==cl) col[i]=col[u],sz[col[u]]++;
		return 1;
	}
	g[col[u]][col[v]]++;
	g[col[v]][col[u]]++;
	return 0;
}
/*
int32_t main(){
	cin>>n;
	initialize(n);
	f(i,0,n*(n-1)/2){
		int u,v;
		cin>>u>>v;
		cout<<hasEdge(u,v)<<endl;
	}
}*/
/*
4 
0 3
2 0
*/
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 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 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 340 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 340 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 0 ms 340 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 340 KB Output is correct
21 Correct 0 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 0 ms 340 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 0 ms 212 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 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 284 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 296 KB Output is correct
14 Correct 0 ms 340 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 340 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 0 ms 340 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 340 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 0 ms 340 KB Output is correct
25 Correct 0 ms 468 KB Output is correct
26 Correct 1 ms 468 KB Output is correct
27 Correct 1 ms 468 KB Output is correct
28 Correct 1 ms 468 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 352 KB Output is correct
31 Correct 1 ms 468 KB Output is correct
32 Correct 1 ms 468 KB Output is correct
33 Correct 1 ms 468 KB Output is correct
34 Correct 1 ms 596 KB Output is correct
35 Correct 2 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 1 ms 596 KB Output is correct
41 Correct 2 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 2 ms 724 KB Output is correct
51 Correct 2 ms 688 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 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 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 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 340 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 340 KB Output is correct
16 Correct 0 ms 340 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 340 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 0 ms 340 KB Output is correct
21 Correct 0 ms 340 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 340 KB Output is correct
24 Correct 0 ms 340 KB Output is correct
25 Correct 1 ms 468 KB Output is correct
26 Correct 1 ms 468 KB Output is correct
27 Correct 1 ms 468 KB Output is correct
28 Correct 1 ms 468 KB Output is correct
29 Correct 1 ms 468 KB Output is correct
30 Correct 1 ms 468 KB Output is correct
31 Correct 1 ms 468 KB Output is correct
32 Correct 1 ms 468 KB Output is correct
33 Correct 1 ms 468 KB Output is correct
34 Correct 1 ms 596 KB Output is correct
35 Correct 2 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 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 2 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
55 Correct 32 ms 4020 KB Output is correct
56 Correct 33 ms 4104 KB Output is correct
57 Correct 32 ms 4024 KB Output is correct
58 Correct 32 ms 4044 KB Output is correct
59 Correct 33 ms 4108 KB Output is correct
60 Correct 33 ms 4100 KB Output is correct
61 Correct 35 ms 4044 KB Output is correct
62 Correct 32 ms 4096 KB Output is correct
63 Correct 35 ms 4036 KB Output is correct
64 Correct 34 ms 4044 KB Output is correct
65 Correct 32 ms 4060 KB Output is correct
66 Correct 32 ms 4076 KB Output is correct
67 Correct 33 ms 4052 KB Output is correct
68 Correct 34 ms 4044 KB Output is correct
69 Correct 34 ms 4044 KB Output is correct
70 Correct 33 ms 4056 KB Output is correct
71 Correct 34 ms 4104 KB Output is correct
72 Correct 32 ms 4112 KB Output is correct
73 Correct 35 ms 4048 KB Output is correct
74 Correct 38 ms 4068 KB Output is correct
75 Correct 32 ms 4088 KB Output is correct
76 Correct 75 ms 6672 KB Output is correct
77 Correct 78 ms 6732 KB Output is correct
78 Correct 74 ms 6640 KB Output is correct
79 Correct 73 ms 6572 KB Output is correct
80 Correct 78 ms 6596 KB Output is correct
81 Correct 74 ms 6660 KB Output is correct
82 Correct 79 ms 6680 KB Output is correct
83 Correct 73 ms 6604 KB Output is correct
84 Correct 74 ms 6604 KB Output is correct
85 Correct 140 ms 9432 KB Output is correct
86 Correct 132 ms 9428 KB Output is correct
87 Correct 142 ms 9432 KB Output is correct
88 Correct 133 ms 9364 KB Output is correct
89 Correct 136 ms 9420 KB Output is correct
90 Correct 137 ms 9444 KB Output is correct
91 Correct 138 ms 9384 KB Output is correct
92 Correct 151 ms 9380 KB Output is correct
93 Correct 149 ms 9348 KB Output is correct
94 Correct 314 ms 15736 KB Output is correct
95 Correct 341 ms 15792 KB Output is correct
96 Correct 317 ms 15720 KB Output is correct
97 Correct 348 ms 15688 KB Output is correct
98 Correct 321 ms 15796 KB Output is correct
99 Correct 323 ms 15852 KB Output is correct
100 Correct 340 ms 15692 KB Output is correct