제출 #216346

#제출 시각아이디문제언어결과실행 시간메모리
216346tushar_2658콤보 (IOI18_combo)C++14
30 / 100
58 ms560 KiB
#include "combo.h" #include "bits/stdc++.h" using namespace std; string guess_sequence(int N) { string s; int tot = 0; if(press("A") == 1){ s = "A"; tot = 1; }else if(press("B") == 1){ s = "B"; tot = 1; }else if(press("X") == 1){ s = "X"; tot = 1; }else { s = "Y"; tot = 1; } if(N == 1)return s; string ss = "ABXY"; for(int i = 0; i < 4; i++){ if(s[0] == ss[i]){ ss.erase(i, 1); break; } } string c; c += ss.back(); ss.pop_back(); string d = ss[0] + c, d1 = ss[1] + c; for(int i = 1; i < N;){ int n = press(s + d); if(n == tot + 2){ s += d; tot += 2; i += 2; }else if(n == tot + 1){ tot++; s += ss[0]; i++; }else { n = press(s + d1); if(n == tot + 2){ s += d1; tot += 2; i += 2; }else if(n == tot + 1){ s += ss[1]; tot++; i++; }else { s += c; tot++; i++; } } } if(tot != N){ int n = press(s + d); if(n == tot + 1){ s += ss[0]; }else if(press(s + d1) == ss[1]){ s += ss[1]; }else { s += c; } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...