제출 #297159

#제출 시각아이디문제언어결과실행 시간메모리
297159shayan_p콤보 (IOI18_combo)C++17
100 / 100
31 ms640 KiB
#include<bits/stdc++.h> #include "combo.h" #define sz(s) (int(s.size())) #define PB push_back using namespace std; // A B X Y string guess_sequence(int n){ string ans; if(press("AB")) ans = press("A") ? "A" : "B"; else ans = press("X") ? "X" : "Y"; vector<string> c; for(string s : {"A", "B", "X", "Y"}) if(ans != s) c.PB(s); for(int i = 2; i < n; i++){ int coin = press(ans + c[0] + ans + c[1] + c[0] + ans + c[1] + c[1] + ans + c[1] + c[2]); if(coin == sz(ans) + 1) ans+= c[0]; else if(coin == sz(ans) + 2) ans+= c[1]; else ans+= c[2]; } if(n > 1){ if(press(ans + c[0]) == n) ans+= c[0]; else if(press(ans + c[1]) == n) ans+= c[1]; else ans+= c[2]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...