제출 #843999

#제출 시각아이디문제언어결과실행 시간메모리
843999Dat160601콤보 (IOI18_combo)C++17
100 / 100
13 ms2012 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back #define fi first #define se second string guess_sequence(int N) { string ans = ""; char arr[4] = {'A', 'B', 'X', 'Y'}; vector<char> listPos; if(press("AB") >= 1) { if(press("A") == 1) { ans = "A"; } else { ans = "B"; } } else { if(press("X") == 1) { ans = "X"; } else { ans = "Y"; } } if(N == 1) return ans; for(int i = 0; i < 4; i++) { if(arr[i] != ans[0]) listPos.pb(arr[i]); } for(int i = 2; i < N; i++) { string query = ans + listPos[0]; query += ans + listPos[1] + listPos[0]; query += ans + listPos[1] + listPos[1]; query += ans + listPos[1] + listPos[2]; int res = press(query); if(res == i - 1) ans += listPos[2]; else if(res == i) ans += listPos[0]; else ans += listPos[1]; } int cnt = 0; for(int i = 0; i < 3; i++) { cnt++; if(cnt == 3 || press(ans + listPos[i]) == N) { ans += listPos[i]; return ans; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...