Submission #766878

#TimeUsernameProblemLanguageResultExecution timeMemory
766878oyberCombo (IOI18_combo)C++14
100 / 100
24 ms692 KiB
#include "combo.h" #include <vector> #include <iostream> using namespace std; string guess_sequence(int N) { vector<char> letters = {'A', 'B', 'X', 'Y'}; string start1 = "AB"; int score = press(start1); string p = ""; if (score > 0) { string start2 = "B"; int score = press(start2); if (score > 0) { letters.erase(letters.begin() + 1); p += "B"; } else { letters.erase(letters.begin()); p += "A"; } } else { string start2 = "X"; int score = press(start2); if (score > 0) { letters.erase(letters.begin() + 2); p += "X"; } else { letters.erase(letters.begin() + 3); p += "Y"; } } if (N == 1) { return p; } for (int i = 1; i < N-1; i++) { string p1 = p + letters[0] + p + letters[1] + letters[0] + p + letters[1] + letters[1] + p + letters[1] + letters[2]; int score = press(p1); if (score == i) { p += letters[2]; } else if (score == i+1) { p += letters[0]; } else if (score == i+2) { p += letters[1]; } } string end1 = p + letters[0]; score = press(end1); if (score == N) { return end1; } string end2 = p + letters[1]; score = press(end2); if (score == N) { return end2; } return p + letters[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...