제출 #1105869

#제출 시각아이디문제언어결과실행 시간메모리
1105869abushbandit_콤보 (IOI18_combo)C++17
100 / 100
28 ms1804 KiB
#include "combo.h" #include "bits/stdc++.h" using namespace std; string guess_sequence(int N) { string s = ""; vector<char> a = {'A','B','X','Y'}; int r = press("AB"); char st; if(r) { r = press("A"); if(r == 1) { st = 'A'; } else { st = 'B'; } } else { r = press("X"); if(r == 1) { st = 'X'; } else { st = 'Y'; } } vector<char> b; for(auto i : a) { if(i != st) b.push_back(i); } //~ for(auto i : b) cout << i << " "; s += st; for(int i = 2;i <= N - 1;i++) { string ns = ""; ns += s; ns += b[0]; for(auto j : b) { ns += s; ns += b[1]; ns += j; } //~ cout << ns << "\n"; r = press(ns); //~ cout << r << "\n"; if(r == (int)s.size()) { s += b[2]; } else if(r == (int)s.size() + 1) { s += b[0]; } else { s += b[1]; } } if(N != 1) { r = press(s + b[0]); if(r == N) { s += b[0]; } else { r = press(s + b[1]); if(r == N) s += b[1]; else s += b[2]; } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...