# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
502875 | Urvuk3 | Game (IOI14_game) | C++17 | 114 ms | 262148 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN=1505;
#define ll long long
#define MAXN 10000
#define fi first
#define se second
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mid (l+r)/2
#define sz(a) int((a).size())
#define all(a) a.begin(),b.begin()
#define mod 1000000007LL
#define endl "\n"
#define PRINT(x) cout<<#x<<'-'<<x<<endl
ll n,res=0;
int dsu[MAXN],sz[MAXN];
vector<vector<int>> cnt(MAXN,vector<int>(MAXN,0));
int root(int x){
while(x!=dsu[x]){
dsu[x]=dsu[dsu[x]];
x=dsu[x];
}
}
void initialize(int n){
iota(dsu,dsu+MAXN+1,0);
fill(sz,sz+MAXN+1,1);
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(i!=j){
cnt[i][j]=1;
cnt[j][i]=1;
}
}
}
}
int hasEdge(int u, int v){
if(cnt[u][v]==1){
cnt[u][v]=0;
cnt[v][u]=0;
for(int k=0;k<n;k++){
if(k!=u && k!=v){
cnt[u][k]+=cnt[v][k];
cnt[k][u]+=cnt[v][k];
cnt[v][k]+=cnt[u][k];
cnt[k][v]+=cnt[u][k];
}
}
return 1;
}
else{
cnt[u][v]--;
cnt[v][u]--;
return 0;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |