Submission #285810

#TimeUsernameProblemLanguageResultExecution timeMemory
285810ipaljakCombo (IOI18_combo)C++14
5 / 100
1 ms236 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define TRACE(x) cerr << #x << " " << x << endl #define _ << " " << string guess_sequence(int N) { string ret = ""; int x = press("AB"); if (x == 2) { ret = "AB"; } if (x == 1) { int y = press("A"); if (y) ret = "A"; else ret = "B"; } if (x == 0) { int y = press("X"); if (y) ret = "X"; else ret = "Y"; } string B = ""; for (char c : "ABXY") if (c != ret[0]) B.push_back(c); for (int i = ret.size(); i < N - 1; ++i) { string guess = ""; for (int j = 0; j < 3; ++j) { guess += ret; guess.push_back(B[0]); guess.push_back(B[j]); } guess += ret; guess.push_back(B[1]); int x = press(guess); assert(x >= i); ret.push_back(B[2 - (x - i)]); } ret.push_back(B[0]); if (press(ret) == N) return ret; ret.pop_back(); ret.push_back(B[1]); if (press(ret) == N) return ret; ret.pop_back(); ret.push_back(B[2]); return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...