Submission #763001

#TimeUsernameProblemLanguageResultExecution timeMemory
763001SanguineChameleonGame (IOI14_game)C++17
42 / 100
1077 ms4152 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; const int maxn = 1.5e3 + 20; vector<int> adj[maxn]; int q[maxn]; int flag[maxn]; int t; void initialize(int n) { for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (j != i) { adj[i].push_back(j); } } } } int hasEdge(int u, int v) { t++; adj[u].erase(find(adj[u].begin(), adj[u].end(), v)); adj[v].erase(find(adj[v].begin(), adj[v].end(), u)); int pt = 0; int sz = 1; q[pt] = u; flag[u] = t; while (pt < sz) { int x = q[pt++]; for (auto y: adj[x]) { if (y == v) { return 0; } if (flag[y] != t) { flag[y] = t; q[sz++] = y; } } } return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...