Submission #783888

#TimeUsernameProblemLanguageResultExecution timeMemory
783888FatihSolakGame (IOI14_game)C++17
100 / 100
311 ms25108 KiB
#include "game.h" #include <bits/stdc++.h> #define N 1500 using namespace std; int par[N]; int cnt[N][N]; int find(int a){ if(a == par[a])return a; return par[a] = find(par[a]); } int n; void initialize(int n){ ::n = n; for(int i = 0;i<n;i++){ par[i] = i; for(int j = 0;j<n;j++){ cnt[i][j] = i != j; } } } int hasEdge(int u, int v){ int tot = cnt[find(v)][find(u)]; cnt[find(u)][find(v)]--; cnt[find(v)][find(u)]--; if(tot > 1){ return 0; } for(int i = 0;i<n;i++){ if(i != find(i))continue; cnt[find(u)][find(i)] += cnt[find(v)][find(i)]; cnt[find(i)][find(u)] += cnt[find(i)][find(v)]; } par[find(v)] = find(u); return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...