# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
106444 |
2019-04-18T14:11:39 Z |
Nodir_Bobiev |
Game (IOI14_game) |
C++14 |
|
3 ms |
384 KB |
# include <iostream>
using namespace std;
int N;
int p[2000];
int quan[2000];
int cnt[2000][2000];
int get( int x )
{
if( p[x] == x )
return x;
else
return p[x] = get( p[x] );
}
void unin( int x, int y )
{
for ( int i = 1; i <= N; i ++ ){
if ( i != x ){
cnt[i][x] += cnt[i][y];
cnt[x][i] += cnt[i][y];
}
}
quan[x] += quan[y];
p[y] = x;
}
void initialize( int n )
{
N = n;
for ( int i = 1; i <= N; i ++ )
p[i] = i;
for ( int i = 1; i <= N; i ++ )
quan[i] = 1;
}
int hasEdge( int v, int u )
{
int x = v ;
int y = u ;
x = get( x );
y = get( y );
if ( x == y )
return 1;
if ( quan[x] * quan[y] - cnt[x][y] == 1 ){
unin( x, y );
return 1;
}
else{
cnt[x][y] ++;
cnt[y][x] ++;
return 0;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |