Submission #66296

#TimeUsernameProblemLanguageResultExecution timeMemory
66296someone_aaGame (IOI14_game)C++17
100 / 100
882 ms160880 KiB
#include <bits/stdc++.h> #include "game.h" using namespace std; const int maxn = 1600; int s[maxn][maxn], parent[maxn]; int n; void initialize(int N) { for(int i=0;i<N;i++) { parent[i] = i; for(int j=0;j<N;j++) s[i][j] = 1; s[i][i] = 0; } n = N; } void unite(int u, int v) { if(u > v) swap(u, v); for(int i=0;i<n;i++) { s[u][i] = s[i][u] = s[u][i] + s[v][i]; } for(int i=0;i<n;i++) { if(parent[i] == v) parent[i] = u; } } int hasEdge(int u, int v) { u = parent[u]; v = parent[v]; if(s[u][v] == 1) { unite(u, v); return 1; } else { s[u][v]--; s[v][u]--; return 0; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...