Submission #601630

#TimeUsernameProblemLanguageResultExecution timeMemory
601630idiot123Combo (IOI18_combo)C++14
100 / 100
41 ms440 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string guess_sequence(int N) { string ans; if(press("AB") >= 1){ if(press("A") == 1){ ans = "A"; }else{ ans = "B"; } }else{ if(press("X") == 1){ ans = "X"; }else{ ans = "Y"; } } if(N == 1)return ans; vector<string> letters; if(ans != "A")letters.push_back("A"); if(ans != "B")letters.push_back("B"); if(ans != "X")letters.push_back("X"); if(ans != "Y")letters.push_back("Y"); string a = ans + letters[0]; string b = ans + letters[1]; string c = ans + letters[2]; for(int i = 2; i < N; i++){ int x = press(a + letters[0] + a + letters[1] + b + letters[0]); if(x < i){ a = c; b = c; a += letters[0]; b += letters[1]; c += letters[2]; }else if(x == i){ c = b; a += letters[2]; b += letters[1]; c += letters[2]; }else{ c = b; b = a; a += letters[0]; b += letters[1]; c += letters[0]; } } if(press(a) == N){ //cout<<a<<"\n"; return a; }else if(press(b) == N){ //cout<<b<<"\n"; return b; }else{ //cout<<c<<"\n"; return c; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...