Submission #881531

#TimeUsernameProblemLanguageResultExecution timeMemory
881531androCombo (IOI18_combo)C++14
100 / 100
14 ms2036 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; /* int N; string S="ABXYB"; int press(std::string p) { cout<<"? "<<p; cout<<endl; int x; cin>>x; return x; }*/ std::string guess_sequence(int N) { string pref=""; if(press("AB")){ if(press("A"))pref="A"; else pref="B"; } else { if(press("X"))pref="X"; else pref="Y"; } vector<char>probaj; if(pref[0]!='A')probaj.push_back('A'); if(pref[0]!='B')probaj.push_back('B'); if(pref[0]!='X')probaj.push_back('X'); if(pref[0]!='Y')probaj.push_back('Y'); //for(auto it:probaj)cout<<it<<" "; //cout<<endl; for(int i=1;i<=N-2;i++){ string pitam=""; for(int j=0;j<3;j++){ pitam+=pref; pitam+=probaj[0]; pitam+=probaj[j]; } pitam+=pref; pitam+=probaj[1]; int x=press(pitam); //cout<<x<<" "<<pitam; //cout<<endl; if(x==(int)pref.size()+2)pref+=probaj[0]; else if(x==(int)pref.size()+1)pref+=probaj[1]; else pref+=probaj[2]; } if(N>1){ if(press(pref+probaj[0]+pref+probaj[1])==N){ if(press(pref+probaj[0])==N)pref+=probaj[0]; else pref+=probaj[1]; } else pref+=probaj[2]; } return pref; }/* int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; cin>>n; cout<<guess_sequence(n); }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...