Submission #849211

#TimeUsernameProblemLanguageResultExecution timeMemory
849211abcvuitunggioGame (IOI14_game)C++17
100 / 100
262 ms26684 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; int N,p[1501],cnt[1501][1501]; int f(int u){ return (p[u]==u?u:p[u]=f(p[u])); } void initialize(int n){ N=n; iota(p,p+n,0); for (int i=0;i<n;i++) for (int j=0;j<n;j++) cnt[i][j]=1; } int hasEdge(int u, int v){ u=f(u); v=f(v); cnt[u][v]--; cnt[v][u]--; if (!cnt[u][v]){ p[v]=u; for (int i=0;i<N;i++) if (i==f(i)&&i!=u){ cnt[u][i]+=cnt[v][i]; cnt[i][u]+=cnt[v][i]; } } return (!cnt[u][v]); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...