제출 #123562

#제출 시각아이디문제언어결과실행 시간메모리
123562johutha동굴 (IOI13_cave)C++14
51 / 100
2048 ms512 KiB
#include "cave.h" #include <vector> #include <iostream> using namespace std; int n; vector<int> perms; vector<int> combsol; int ask(vector<int> out) { vector<int> tos(n); for (int i = 0; i < n; i++) { if (perms[i] != -1) { tos[i] = combsol[i]; } else { tos[i] = out[i]; } } int r = tryCombination(tos.data()); return r; } int ask0() { vector<int> tos(n); for (int i = 0; i < n; i++) { if (perms[i] != -1) { tos[i] = combsol[i]; } else { tos[i] = 0; } } int r = tryCombination(tos.data()); return r; } void exploreCave(int in) { n = in; perms.resize(n, -1); combsol.resize(n, -1); int l2 = 13; for (int i = 0; i < n; i++) { int resp = 0; bool inv = (ask0() != i); int up = 1; for (int j = 0; j < l2; j++) { vector<int> out(n); for (int k = 0; k < n; k++) { out[k] = inv ^ ((k / up) % 2); } int r = ask(out); if (r != i) resp += up; up *= 2; } perms[resp] = i; combsol[resp] = !inv; } answer(combsol.data(), perms.data()); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...