Submission #745124

#TimeUsernameProblemLanguageResultExecution timeMemory
745124teo_thrashCombo (IOI18_combo)C++14
100 / 100
30 ms652 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int n) { string p="AB"; vector<char> a={'A', 'B', 'X', 'Y'}; string S, curr; vector<char> let; if(!press("AB")){ p="XY"; } char c=p[0]; if(!press(p.substr(0, 1))){ c=p[1]; } S+=c; //cerr<<"first char is "<<c<<endl; for(char i: a){ if(i!=c){ let.push_back(i); // cerr<<a[i]<<" "; } } //cerr<<endl; int coins=0; for(int i=2; i<n; i++){ curr=S+let[0]+let[0] + S+let[0]+let[1] + S+let[0]+let[2] + S+let[1]; coins=press(curr); if(coins==i+1){ S+=let[0]; } if(coins==i){ S+=let[1]; } if(coins==i-1){ S+=let[2]; } } if(n>1){ if(press(S+let[0])==n){ S+=let[0]; }else{ if(press(S+let[1])==n){ S+=let[1]; }else{ S+=let[2]; } } } //cerr<<"S="<<S<<endl; return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...