Submission #226030

#TimeUsernameProblemLanguageResultExecution timeMemory
2260308e7Game (IOI14_game)C++14
15 / 100
6 ms384 KiB
#include <iostream> #include <algorithm> #include <set> #include <bitset> using namespace std; bitset<1505> bits[1505]; int cnt[1505] = {}; set<int> block; void initialize(int n){ for (int i = 0;i < 1505;i++) { cnt[i] = 1; } } int hasEdge(int a, int b){ if (cnt[a] == 1 || cnt[b] == 1) { int inset = -1; if (block.find(a) == block.end()) inset = a, block.insert(a); if (block.find(b) == block.end()) inset = b, block.insert(b); for (int i = 0;i < 1505;i++) { if (i != a && i != b) { if (!bits[inset][i]) { cnt[i]++; } } else { cnt[i] = -100000; } } bits[a][b] = bits[b][a] = 1; return 1; } else { bits[a][b] = bits[b][a] = 1; if (block.find(a) != block.end()) cnt[b]--; if (block.find(b) != block.end()) cnt[a]--; return 0; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...