Submission #1037021

#TimeUsernameProblemLanguageResultExecution timeMemory
1037021JuanJLCombo (IOI18_combo)C++17
5 / 100
0 ms344 KiB
#include <bits/stdc++.h> #include "combo.h" #define SZ(x) (int)x.size() typedef long long ll; using namespace std; std::string guess_sequence(int N) { std::string p = ""; string options = ""; ll coins = press("AB"); if(coins>=1){ coins=press("A"); if(coins==1) options = "BXY", p+="A"; else options = "AXY", p+="B"; }else{ coins = press("X"); if(coins==1) options = "ABY",p+="X"; else options = "ABX",p+="Y"; } //cout<<p<<'\n'; string aux = ""; for(int i = 1; i < N-1; i++){ aux=p+options[0]+options[0]; aux+=p+options[0]+options[1]; aux+=p+options[0]+options[2]; aux+=p+options[1]; //cout<<aux<<" "; coins = press(aux); if(coins==SZ(p)+2) p+=options[0]; else if(coins==SZ(p)+1) p+=options[1]; else p+=options[2]; //cout<<p<<'\n'; } aux=p+options[0]; coins=press(aux); if(coins>=SZ(p)+1) p+=options[0]; else{ aux=p+options[1]; coins=press(aux); if(coins>=SZ(p)+1) p+=options[1]; else p+=options[2]; } //cout<<p<<'\n'; return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...