Submission #125665

#TimeUsernameProblemLanguageResultExecution timeMemory
125665dragoonCombo (IOI18_combo)C++14
97 / 100
301 ms2064 KiB
#include "combo.h" #include<string> #include <assert.h> #include <iostream> #include <algorithm> using namespace std; string FindFirstChar() { if (press("AB")) { if (press("A")) return "A"; else return "B"; } if (press("X")) return "X"; return "Y"; } string guess_sequence(int N) { string now = FindFirstChar(); if (N == 1) return now; string remaining = "ABXY"; remaining.erase(find(remaining.begin(), remaining.end(), now[0])); for (int i = 2; i < N; i++) { string current = (now + remaining[0]) + (now + remaining[1] + remaining[0]) + (now + remaining[1] + remaining[1]) + (now + remaining[1] + remaining[2]); int coin = press(current); if (coin == i - 1) now.push_back(remaining[2]); else if (coin == i) now.push_back(remaining[0]); else now.push_back(remaining[1]); } for (int i = 0; i < 3; i++) { if (press(now + remaining[i]) == N) return now + remaining[i]; } return ""; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...