Submission #172231

#TimeUsernameProblemLanguageResultExecution timeMemory
172231mcl2000Combo (IOI18_combo)C++11
100 / 100
54 ms568 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string guess_sequence(int N) { string p = "", aux = "", primera = ""; int tam=1; int coins = press("AB");; if(!coins) { coins=press("X"); if(coins) aux="ABY", primera="X"; else aux="ABX", primera="Y"; } else { coins=press("A"); if(coins) aux="XYB", primera="A"; else aux="XYA", primera="B"; } p+=primera; if(N==1) return p; for(int i=2; i<=N-1; i++) { coins=press(p+aux[0]+p+aux[1]+aux[0]+p+aux[1]+aux[1]+p+aux[1]+aux[2]); if(coins==tam) p+=aux[2]; else if(coins==tam+1) p+=aux[0]; else p+=aux[1]; tam++; } coins=press(p+aux[0]+p+aux[1]); if(coins==tam) p+=aux[2]; else if(press(p+aux[0])==tam+1) p+=aux[0]; else p+=aux[1]; return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...