제출 #715630

#제출 시각아이디문제언어결과실행 시간메모리
715630adrilen콤보 (IOI18_combo)C++17
100 / 100
34 ms576 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; using ll = long long; typedef pair<int, int> pii; string guess_sequence(int n) { string output; vector <string> letters = { "A", "B", "X", "Y" }; string mark; if (press("AB") > 0) { if (press("A")) mark = "A"; else mark = "B"; } else { if (press("X")) mark = "X"; else mark = "Y"; } if (n == 1) return mark; for (int i = 0; i < 4; i++) { if (letters[i] == mark) { letters.erase(letters.begin() + i); break; } } output += mark; size_t val; while (output.size() + 1 < (size_t)n) { val = press(output + letters[1] + output + letters[2] + letters[0] + output + letters[2] + letters[1] + output + letters[2] + letters[2]); output += letters[val - output.size()]; } if (press(output + letters[0] + output + letters[1]) > (int)output.size()) { if (press(output + letters[0]) > (int)output.size()) output += letters[0]; else output += letters[1]; } else { output += letters[2]; } return output; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...