제출 #299290

#제출 시각아이디문제언어결과실행 시간메모리
299290Valee콤보 (IOI18_combo)C++14
100 / 100
40 ms616 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string s = ""; int pos = 1, x; vector<char>v; if (pos == 1){ x = press("AB"); if (!x){ x = press("X"); if (x) s += "X"; else s += "Y"; } else{ x = press("A"); if (x) s += "A"; else s += "B"; } pos++; } if (s[0] != 'A') v.push_back('A'); if (s[0] != 'B') v.push_back('B'); if (s[0] != 'X') v.push_back('X'); if (s[0] != 'Y') v.push_back('Y'); while (pos < N){ string t = ""; t += s; t += v[0]; t += s; t += v[1]; t += v[0]; t += s; t += v[1]; t += v[1]; t += s; t += v[1]; t += v[2]; x = press(t); if (x == pos) s += v[0]; else if (x == pos+1) s += v[1]; else s += v[2]; pos++; } if (pos == N){ string t = ""; t += s; t += v[0]; x = press(t); if (x == N) {return t;} t = s; t += v[1]; x = press(t); if (x == N) {return t;} s += v[2]; return s; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...