제출 #685855

#제출 시각아이디문제언어결과실행 시간메모리
685855grossly_overconfident콤보 (IOI18_combo)C++17
0 / 100
1 ms256 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; while (l < N - 1) { string testcase; 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) { return result; } string testcase; testcase = result + letter[0]; if (press(testcase) > l) { return testcase; } testcase = result + letter[0]; if (press(testcase) > l) { return testcase; } result += letter[2]; return result; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...