제출 #500889

#제출 시각아이디문제언어결과실행 시간메모리
500889aymanrs콤보 (IOI18_combo)C++14
100 / 100
38 ms576 KiB
#include <bits/stdc++.h> using namespace std; int press(string p); // cout << p << '\n'; // int r; // cin >> r; // return r; // } string guess_sequence(int n){ string s; if(press("AB")){ if(press("A")) s += 'A'; else s += 'B'; } else { if(press("X")) s += 'X'; else s += 'Y'; } if(n == 1) return s; vector<char> c = {'A', 'B', 'X', 'Y'}; for(int i = 0;i < 4;i++) if(c[i] == s[0]) { c.erase(c.begin()+i); break; } for(int i = 1;i < n-1;i++){ int r = press(s + c[0] + c[0] + s + c[0] + c[1] + s + c[0] + c[2] + s + c[1]); if(r == i+2) s += c[0]; else if (r == i+1) s += c[1]; else s += c[2]; } if(press(s + c[0] + s + c[1]) == n){ if(press(s + c[0]) == n) s += c[0]; else s += c[1]; } else s += c[2]; return s; } // int main(){ // guess_sequence(6); // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...