제출 #215937

#제출 시각아이디문제언어결과실행 시간메모리
215937tushar_2658콤보 (IOI18_combo)C++14
0 / 100
1 ms200 KiB
#include "combo.h" #include "bits/stdc++.h" using namespace std; string guess_sequence(int N) { string ans; ans ="A"; int tot = press(ans); if(tot == 0){ ans = "B"; tot = press(ans); } else if(tot == 0){ ans = "X"; tot = press(ans); } else if(tot == 0){ ans = "Y"; } if(N == 1){ string ret; ret += ans[0]; return ret; } string ss = "ABXY"; char c; for(int j = 0; j < 3; j++){ if(ss[j] == ans[0]){ ss.erase(j, 1); } } c = ss.back(); ss.pop_back(); for(int i = 1; i < N; ){ string dummy; dummy += ss[0]; dummy += c; int x = press(ans + dummy); if(x == tot + 2){ ans += dummy; tot += 2; i += 2; continue; }else if(x == tot + 1){ ans += ss[0]; i++; tot++; continue; } dummy[0] = ss[1]; x = press(ans + dummy); if(x == tot + 2){ ans += dummy; tot += 2; i += 2; continue; }else if(x == tot + 1){ ans += ss[0]; i++; tot++; continue; } ans += c; tot++; i++; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...