제출 #996983

#제출 시각아이디문제언어결과실행 시간메모리
996983TrendBattles콤보 (IOI18_combo)C++14
100 / 100
20 ms1524 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string choices = "ABXY"; string ret = ""; int pos = -1; if (press(string(1, choices[0]) + string(1, choices[1]))) { pos = press(string(1, choices[1])); } else { pos = 2 + press(string(1, choices[3])); } ret.push_back(choices[pos]); choices.erase(pos, 1); for (int i = 1; i < N; ++i) { if (i == N - 1) { pos = 2; for (int j : {0, 1}) { if (press(ret + choices[j]) == N){ pos = j; break; } } ret.push_back(choices[pos]); break; } string ask = ""; ret.push_back(choices[0]); for (int j : {0, 1, 2}) { ret.push_back(choices[j]); ask += ret; ret.pop_back(); } ret.pop_back(); ret.push_back(choices[1]); ask += ret; ret.pop_back(); int len = press(ask); if (len == i + 2) { ret.push_back(choices[0]); } else if (len == i + 1) { ret.push_back(choices[1]); } else { ret.push_back(choices[2]); } } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...