제출 #685860

#제출 시각아이디문제언어결과실행 시간메모리
685860grossly_overconfident콤보 (IOI18_combo)C++17
0 / 100
0 ms208 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string f; vector<char> letter; if (press("AB") != 0) { if (press("A") == 1) { f = "A"; letter = { 'B', 'X', 'Y' }; } else { f = "B"; letter = { 'A', 'X', 'Y' }; } } else { if (press("X") == 1) { f = "X"; letter = { 'B', 'A', 'Y' }; } else { f = "Y"; letter = { 'B', 'X', 'A' }; } } int l = 1; string result = f; string testcase; while (true) { testcase = result + letter[0] + letter[1] + result + letter[1] + letter[0]; int outcome = press(testcase); if (outcome == l) { result += letter[2]; l += 1; } else if (outcome == l + 2) { testcase = result; testcase += letter[0] + letter[1]; if (press(testcase) == l) { result += letter[1] + letter[0]; } else { result += letter[0] + letter[1]; } l += 2; } else { testcase = result; testcase += letter[0] + letter[2]; if (press(testcase) == l) { result += letter[1] + letter[2]; } else { result += letter[0] + letter[2]; } l += 2; } if (l == N || l == N - 1) { break; } } if (l == N) { return result; } string testcase1; testcase1 = result + letter[0]; if (press(testcase1) > l) { return testcase1; } testcase1 = result + letter[0]; if (press(testcase1) > l) { return testcase1; } result += letter[2]; return result; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...