| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 171712 | Nodir_Bobiev | 게임 (IOI14_game) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
# include <bits/stdc++.h>
# define FILE
using namespace std;
int n,cn[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);
}
*/
