Submission #412408

#TimeUsernameProblemLanguageResultExecution timeMemory
412408dolijanCombo (IOI18_combo)C++14
100 / 100
58 ms624 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int n) { /*std::string p = ""; for (int i = 0; i < 4 * N; ++i) { p += 'A'; } int coins = press(p); std::string S = ""; for (int i = 0; i < N; ++i) { S += 'A'; }*/ string s=""; vector<string> sta; if(press("AB")!=0) { if(press("A")==1) s+="A"; else s+="B"; } else { if(press("X")==1) s+="X"; else s+="Y"; } //cout<<s<<endl; if(s!="A") sta.push_back("A"); if(s!="B") sta.push_back("B"); if(s!="X") sta.push_back("X"); if(s!="Y") sta.push_back("Y"); //for(int i=0;i<3;i++) cout<<sta[i]<<endl; for(int i=1;i<n-1;i++) { string kveri=""; kveri+=s; kveri+=sta[0]; string wt=""; for(int i=0;i<3;i++) { wt+=kveri; wt+=sta[i]; } wt+=s; wt+=sta[1]; int odg=press(wt); if(odg==i) s+=sta[2]; else if(odg==i+1) s+=sta[1]; else s+=sta[0]; //cout<<s<<endl; } //cout<<s<<endl; if(n==1) return s; if(press(s+sta[0])==n) return s+sta[0]; else if(press(s+sta[1])==n) return s+sta[1]; return s+sta[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...