제출 #528757

#제출 시각아이디문제언어결과실행 시간메모리
528757ahmeteren콤보 (IOI18_combo)C++17
100 / 100
30 ms596 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string ans; array<string, 4> arr = {"A", "X", "Y", "B"}; if(press(arr[0] + arr[1])) { if(press(arr[0])) { ans += arr[0]; } else { ans += arr[1]; } } else { if(press(arr[2])) { ans += arr[2]; } else { ans += arr[3]; } } if(N == 1) { return ans; } int it = 0; array<string, 3> temp; for(int i = 0; i < 4; i++) { if(arr[i] == ans) continue; temp[it++] = arr[i]; } for(int i = 0; i < 3; i++) { arr[i] = temp[i]; } for(int i = 1; i < N - 1; i++) { int x = press(ans + arr[0] + arr[0] + ans + arr[0] + arr[1] + ans + arr[0] + arr[2] + ans + arr[1]); if(x == i) { ans += arr[2]; } else if(x == i + 1) { ans += arr[1]; } else { ans += arr[0]; } } if(press(ans + arr[0]) == N) { ans += arr[0]; } else if(press(ans + arr[1]) == N) { ans += arr[1]; } else { ans += arr[2]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...