Submission #736802

#TimeUsernameProblemLanguageResultExecution timeMemory
736802NeroZeinGame (IOI14_game)C++17
100 / 100
428 ms25272 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; int n; vector<int> rem; vector<int> with; vector<vector<int>> answered; void initialize(int n_) { n = n_; rem.resize(n); with.resize(n); answered.resize(n); for (int i = 0; i < n; ++i) { answered[i].resize(n); } with[0] = true; for (int i = 1; i < n; ++i) { rem[i] = 1; } } int hasEdge(int u, int v) { answered[u][v] = answered[v][u] = 1; if (!with[u] && !with[v]) { return 0; } if (with[u] && with[v]) { return 1; } if (!with[u]) { swap(u, v); } // u is the one with 0 if (rem[v] - 1 > 0) { --rem[v]; return 0; } else { with[v] = true; for (int i = 0; i < n; ++i) { if (!answered[v][i] && !with[i]) { ++rem[i]; } } return 1; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...