# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
256539 | 2020-08-02T20:08:37 Z | Harry464 | Cave (IOI13_cave) | C++14 | 1118 ms | 536 KB |
#include <iostream> #include <algorithm> #include <cmath> #include <vector> #include "cave.h" using namespace std; void exploreCave(int n) { vector <int> sw(n,0); vector <int> odg(n,-1); for (int j = 0; j < n; j++){ vector <int> t = sw; vector <int> free; for (int i = 0; i < n; i++) if (odg[i] == -1) free.push_back(i), t[i] = 1; int ask = tryCombination(&t[0]); int trig; if (ask == j) trig = 0; else trig = 1; int l = 0, r = free.size() - 1; while (l < r){ int 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[0]); if (ask == j) l = mid + 1; else r = mid; } l--; sw[l] = trig; odg[l] = j; } answer(&sw[0],&odg[0]); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 702 ms | 504 KB | Answer is wrong |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1118 ms | 536 KB | Answer is wrong |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 256 KB | Answer is wrong |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 256 KB | Answer is wrong |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 702 ms | 504 KB | Answer is wrong |
2 | Halted | 0 ms | 0 KB | - |