Submission #209474

#TimeUsernameProblemLanguageResultExecution timeMemory
209474urd05Combo (IOI18_combo)C++14
100 / 100
36 ms532 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; char s[4]={'A','B','X','Y'}; string guess_sequence(int n) { string st; st.push_back(s[0]); st.push_back(s[1]); int f; if (press(st)>=1) { st.clear(); st.push_back(s[0]); if (press(st)==1) { f=0; } else { f=1; } } else { st.clear(); st.push_back(s[2]); if (press(st)==1) { f=2; } else { f=3; } } string ret; ret.push_back(s[f]); if (n==1) { return ret; } char one; char two; char three; for(int i=0;i<4;i++) { if (i!=f) { one=s[i]; for(int j=i+1;j<4;j++) { if (j!=f) { two=s[j]; for(int k=j+1;k<4;k++) { if (k!=f) { three=s[k]; break; } } break; } } break; } } for(int i=1;i<n-1;i++) { string temp; temp+=ret; temp.push_back(one); temp.push_back(one); temp+=ret; temp.push_back(one); temp.push_back(two); temp+=ret; temp.push_back(one); temp.push_back(three); temp+=ret; temp.push_back(two); int val=press(temp); if (val==i+2) { ret.push_back(one); } if (val==i+1) { ret.push_back(two); } if (val==i) { ret.push_back(three); } } string o; o+=ret; o.push_back(one); string t; t+=ret; t.push_back(two); if (press(o)==n) { ret.push_back(one); } else if (press(t)==n) { ret.push_back(two); } else { ret.push_back(three); } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...