Submission #1145629

#TimeUsernameProblemLanguageResultExecution timeMemory
1145629guagua0407Combo (IOI18_combo)C++20
100 / 100
7 ms508 KiB
#include "combo.h" //#include "grader.cpp" #include <bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int,int> #define f first #define s second #define all(x) x.begin(),x.end() #define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); std::string guess_sequence(int n) { string str; char st; vector<char> cs={'X','Y'}; if(press("XY")==0) cs={'A','B'}; st=cs[0]; if(press(string(1,cs[0]))==0) st=cs[1]; vector<char> cand; for(auto c:{'X','Y','A','B'}){ if(c!=st) cand.push_back(c); } str+=st; for(int i=2;i<n;i++){ string p; p+=(str+cand[0]+cand[0]); p+=(str+cand[0]+cand[1]); p+=(str+cand[0]+cand[2]); p+=(str+cand[1]); int res=press(p); if(res==i+1) str+=cand[0]; else if(res==i) str+=cand[1]; else str+=cand[2]; } if(n==1) return str; cs={cand[0],cand[1]}; if(press(str+cand[0]+str+cand[1])==n){ st=cand[0]; if(press(str+cand[0])!=n) st=cand[1]; } else{ st=cand[2]; } str+=st; //cout<<str<<'\n'; return str; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...