제출 #171713

#제출 시각아이디문제언어결과실행 시간메모리
171713Nodir_Bobiev게임 (IOI14_game)C++14
0 / 100
2 ms400 KiB
# include <bits/stdc++.h> # define FILE using namespace std; int n,cnt[2000][2000]; int p[2000], sz[2000]; int get( int x ){ if( p[x] == x )return x; else return p[x] = get( p[x] ); } void unin( int x, int y ){ x = get( x ); y = get( y ); p[x] = y; sz[y] += sz[x]; for( int i = 0; i < n; i ++ ){ cnt[y][i] += cnt[x][i]; cnt[i][y] += cnt[x][i]; } } void initialize( int m ){ n = m; for( int i = 0; i < n; i ++ ){ p[i] = i; sz[i] = 1; } } bool hasEdge( int u, int v ){ int x = get( u ); int y = get( v ); if( sz[x] * sz[y] - cnt[x][y] == 1 ){ unin( u,v ); return true; } return false; } /* int main(){ # ifdef FILEs freopen( "input.txt", "r", stdin ); freopen( "output.txt", "w", stdout ); # endif ios_base::sync_with_stdio(false); } */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...