Submission #921384

#TimeUsernameProblemLanguageResultExecution timeMemory
921384AverageAmogusEnjoyerCombo (IOI18_combo)C++17
5 / 100
1 ms596 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; template<class T> bool cmin(T &i, T j) { return i > j ? i=j,true:false; } template<class T> bool cmax(T &i, T j) { return i < j ? i=j,true:false; } int press(string p); string guess_sequence(int n) { string res = ""; vector<string> v = {"A","B","X","Y"}; for (int i=0;i<=2;i++) { if (press(v[i])) { res = v[i]; break; } } if (res == "") { res = "Y"; } v.erase(find(v.begin(),v.end(),res)); for (int i=2;i<n;i++) { int r = press(res+v[0]+res+v[1]+v[0]+res+v[1]+v[1]+res+v[1]+v[2]); if (r == i-1) { res += v[2]; } else if (r == i) { res += v[0]; } else { assert(r == i+1); res += v[1]; } assert((int)res.size() == i); } /* if((int)res.size() != n-1) { while(true) {} } */ // gotta guess the last one if (press(res+v[0]) == n) { res += v[0]; } else if (press(res+v[1]) == n) { res += v[1]; } else { res += v[2]; } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...