Submission #982005

#TimeUsernameProblemLanguageResultExecution timeMemory
982005mariaclaraCombo (IOI18_combo)C++17
100 / 100
15 ms1920 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string guess_sequence(int N) { string prefix; vector<string> l; if(N == 1) { if(press("A")) return "A"; if(press("B")) return "B"; if(press("X")) return "X"; return "Y"; } if(press("AB")) { if(press("B")) prefix = "B", l = {"A","X","Y"}; else prefix = "A", l = {"B","X","Y"}; } else { if(press("X")) prefix = "X", l = {"A","B","Y"}; else prefix = "Y", l = {"A","B","X"}; } for(int i = 2; i < N; i++) { string query = prefix + l[0]; query += prefix + l[1] + l[0]; query += prefix + l[1] + l[1]; query += prefix + l[1] + l[2]; int ans = press(query); if(ans == i) prefix += l[0]; else if(ans == i+1) prefix += l[1]; else prefix += l[2]; } if(press(prefix + l[0]) == N) { //cout << prefix + l[0]; return prefix + l[0]; } if(press(prefix + l[1]) == N) { //cout << prefix + l[1]; return prefix + l[1]; } //cout << prefix + l[2]; return prefix + l[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...