# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
930641 |
2024-02-20T08:44:13 Z |
imarn |
Game (IOI14_game) |
C++14 |
|
1 ms |
348 KB |
#include<bits/stdc++.h>
#include "game.h"
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define all(x) x.begin(),x.end()
#define vi vector<int>
#define vvi vector<vi>
#define vp vector<pii>
using namespace std;
const int N=1506;
int sz[N]{0},del[N]{0},pr[N]{0},m;
int get(int r){
return pr[r]==r?r:pr[r]=get(pr[r]);
}
void initialize(int n){
iota(pr,pr+n,0);m=n;
for(int i=0;i<n;i++)sz[i]=1,del[i]=0;
}
int hasEdge(int u,int v){
int a=get(u),b=get(v);
if(a==b)return 1;
if(del[a]<sz[a]*(m-sz[a])&&del[b]<sz[b]*(m-sz[b])){del[a]++,del[b]++;return 0;}
else {sz[a]+=sz[b],del[a]+=del[b],pr[b]=a;return 1;}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |