Submission #650845

#TimeUsernameProblemLanguageResultExecution timeMemory
650845Markomafko972Game (IOI14_game)C++14
15 / 100
2 ms596 KiB
#include "game.h" #include <bits/stdc++.h> #define X first #define Y second #define pb push_back #define pii pair<int, int> typedef long long ll; using namespace std; const int MOD = 1e9 + 7; const ll INF = 1e18; const int OFF = (1 << 20); int br[1502]; int zbr[1502]; int mora[1502][1502]; void dfs(int x) { if (br[x] != 1) return; br[x] = 0; int slj = zbr[x]; zbr[x] = 0; br[slj]--; zbr[slj] -= x; mora[min(x, slj)][max(x, slj)] = 1; dfs(slj); } void initialize(int n) { for (int i = 0; i < n; i++) { br[i] = n-1; zbr[i] = n*(n-1)/2-i; } } int hasEdge(int x, int y) { if (x > y) swap(x, y); if (mora[x][y]) return 1; br[x]--; zbr[x] -= y; br[y]--; zbr[y] -= x; if (br[x] == 1) dfs(x); if (br[y] == 1) dfs(y); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...