제출 #654264

#제출 시각아이디문제언어결과실행 시간메모리
654264natsirt05콤보 (IOI18_combo)C++17
100 / 100
34 ms664 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { //string a = ""; vector<char> b = {'A', 'B', 'X', 'Y'}; string s = ""; //for (int i = 0; i < 3; i++) { string a = ""; a = b[0]; a += b[1]; //cout << a << "\n"; if (press(a) >= 1) { a = b[0]; if (press(a) == 1) { s += b[0]; b.erase(b.begin()); } else { s += b[1]; b.erase(b.begin() + 1); } } else { a = b[2]; if (press(a)) { s += b[2]; b.erase(b.begin()+2); } else { s += b[3]; b.erase(b.begin()+3); } } for (int i = 2; i < N; i++) { string a; a = s + b[0] + s + b[1] + b[0] + s + b[1] + b[1] + s + b[1] + b[2]; //cout << a << "\n"; int t = press(a); if (t == (i)) { s += b[0]; } else if (t == i+1) { s += b[1]; } else { s += b[2]; } //cout <<t<<" " << s<< "\n"; } if (N != 1) { a = s + b[0] + s + b[1]; //cout << a << "\n"; if (press(a) == N) { a = s+b[0]; if (press(a) == N) { s += b[0]; //b.erase(b.begin()); } else { s += b[1]; //b.erase(b.begin() + 1); } } else { s += b[2]; } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...