제출 #705619

#제출 시각아이디문제언어결과실행 시간메모리
705619garyye콤보 (IOI18_combo)C++14
0 / 100
0 ms208 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { vector<char> c = {'A', 'B', 'X', 'Y'}; string f = ""; if(press("XY") > 0) { f = press("X") > 0 ? "X" : "Y"; } else { f = press("A") > 0 ? "A" : "B"; } c.erase(find(c.begin(), c.end(), f[0])); // A. -> 1 // BA. -> 2 // BB. -> 2 // BC. -> 2 // B. -> 1 // CA -> 2 // CB -> 2 for(int i = 1; i < N - 1; ++i) { string s = ""; s += f + c[0]; s += f + c[1] + c[0]; s += f + c[1] + c[1]; s += f + c[1] + c[2]; int g = press(s); if(g == 0) f += c[2]; if(g == 1) f += c[0]; if(g == 2) f += c[1]; } // 2 + (N - 2) calls done if(press(f + c[0]) == N) return f + c[0]; if(press(f + c[1]) == N) return f + c[1]; return f + c[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...