Submission #120962

#TimeUsernameProblemLanguageResultExecution timeMemory
120962kimbj0709Combo (IOI18_combo)C++17
100 / 100
53 ms588 KiB
#include<bits/stdc++.h> using namespace std; #include "combo.h" string guess_sequence(int N) { string ans = ""; vector<char> vect1 = {'A','B','X','Y'}; if(press("AB")>=1){ if(press("A")==1){ //cout << "YES"; ans += 'A'; vect1.erase(find(vect1.begin(),vect1.end(),'A')); } else{ ans += 'B'; vect1.erase(find(vect1.begin(),vect1.end(),'B')); } } else{ if(press("X")==1){ ans += 'X'; vect1.erase(find(vect1.begin(),vect1.end(),'X')); } else{ ans += 'Y'; vect1.erase(find(vect1.begin(),vect1.end(),'Y')); } } if(N==1){ return ans; } for(int i=1;i<N-1;i++){ string temp = ""; temp += ans; temp += vect1[0]; temp += ans+vect1[1]+vect1[0]; temp += ans+vect1[1]+vect1[1]; temp += ans+vect1[1]+vect1[2]; int k = press(temp); if(k==i+1){ ans += vect1[0]; } else if(k==i){ ans += vect1[2]; } else{ ans += vect1[1]; } } if(press(ans+vect1[0])==N){ ans += vect1[0]; } else if(press(ans+vect1[1])==N){ ans += vect1[1]; } else{ ans += vect1[2]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...