# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
256529 | 2020-08-02T19:55:31 Z | Harry464 | Cave (IOI13_cave) | C++14 | 317 ms | 512 KB |
#include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <cstring> #include "cave.h" typedef int ll; using namespace std; void exploreCave(int n) { ll sw[n]; memset(sw,0,n); ll odg[n]; memset(odg,-1,n); for (int j = 0; j < n; j++){ ll t[n]; for (int i = 0; i < n; i++) t[i] = sw[i]; vector <ll> free; for (int i = 0; i < n; i++) if (odg[i] == -1) free.push_back(i), t[i] = 1; ll ask = tryCombination(t); ll trig; if (ask == j) trig = 0; else trig = 1; ll l = 0, r = free.size() - 1; while (l < r){ ll mid = (l+r)/2; for (int i = l; i <= mid; i++) t[free[i]] = trig; for (int i = 0; i < l; i++) t[free[i]] = (trig+1)%2; for (int i = mid + 1; i < free.size(); i++) t[free[i]] = (trig+1)%2; ask = tryCombination(t); if (ask == j) l = mid + 1; else r = mid; } sw[l] = trig; odg[l] = j; } answer(sw,odg); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 188 ms | 488 KB | Answer is wrong |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 317 ms | 512 KB | Answer is wrong |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 384 KB | Answer is wrong |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 384 KB | Answer is wrong |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 188 ms | 488 KB | Answer is wrong |
2 | Halted | 0 ms | 0 KB | - |