Submission #282457

#TimeUsernameProblemLanguageResultExecution timeMemory
282457shayan_pGame (IOI14_game)C++17
100 / 100
530 ms21752 KiB
#include<bits/stdc++.h> #include "game.h" #define F first #define S second #define sz(s) (int(s.size())) #define PB push_back #define bit(n, k) (((n)>>(k))&1) using namespace std; typedef pair<int, int> pii; typedef long long ll; const int maxn = 1510, mod = 1e9 + 7, inf = 1e9 + 10; int ed[maxn][maxn]; int boss[maxn]; vector<int> inside[maxn]; int n; void initialize(int n){ ::n = n; for(int i = 0; i < n; i++){ inside[i].PB(i); boss[i] = i; } } int hasEdge(int u, int v){ u = boss[u], v = boss[v]; ed[u][v]++, ed[v][u]++; if(ed[u][v] == sz(inside[u]) * sz(inside[v])){ for(int x : inside[v]) boss[x] = u, inside[u].PB(x); for(int i = 0; i < n; i++) if(boss[i] == i) ed[i][u]+= ed[i][v], ed[u][i]+= ed[v][i]; return 1; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...