Submission #274674

#TimeUsernameProblemLanguageResultExecution timeMemory
274674Haunted_CppCombo (IOI18_combo)C++17
5 / 100
1 ms280 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { vector<char> letter = {'A', 'B', 'X', 'Y'}; char first_one; int s = press("AB"); if (s) { s = press("A"); if (s == 0) first_one = 'B'; else first_one = 'A'; } else { s = press("X"); if (s == 0) first_one = 'Y'; else first_one = 'X'; } letter.erase(find(letter.begin(), letter.end(), first_one)); string S; S += first_one; for (int i = 1; i < N - 1; i++) { string guess = S + letter[0]; guess += S + letter[1] + letter[1]; guess += S + letter[1] + letter[0]; guess += S + letter[1] + letter[2]; int score = press(guess); if (score == i + 1) { S += letter[0]; } else if (score == i + 2) { S += letter[1]; } else { S += letter[2]; } } string guess = S + letter[0]; if (press(guess) == N) { return guess; } guess = S + letter[1]; if (press(guess) == N) { return guess; } guess = S + letter[2]; return guess; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...