제출 #919520

#제출 시각아이디문제언어결과실행 시간메모리
919520Nurislam콤보 (IOI18_combo)C++14
100 / 100
13 ms1992 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { string v = "ABXY"; string ans = ""; int x = press("AB"); int f; if(x > 0){ x = press("A"); if(x > 0)f = 0; else f = 1; }else{ x = press("X"); if(x > 0)f = 2; else f = 3; } ans+=v[f]; if(n == 1)return ans; swap(v[3], v[f]); for(int i = 1; i < n-1; i++){ string p = ""; for(int j = 0; j < 3; j++)p += ans+v[0]+v[j]; p += ans+v[1]; int x = press(p); if(x==(int)ans.size())ans+=v[2]; else if(x-1 == (int)ans.size())ans+=v[1]; else ans+=v[0]; } if(press(ans+v[0]) == n)return ans+v[0]; else if(press(ans+v[1]) == n)return ans+v[1]; return ans+v[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...