Submission #677533

#TimeUsernameProblemLanguageResultExecution timeMemory
677533hello_there_123Combo (IOI18_combo)C++17
94 / 100
40 ms712 KiB
#include<bits/stdc++.h> //#include "combo.h" using namespace std; int press(string s); string guess_sequence(int N){ string arr[4]={"A","B","X","Y"}; vector<string>v; if(N==1){ for(int i=0;i<4;i++){ if(press(arr[i]) == 1) return arr[i]; } } else{ string ans = ""; string start = ""; for(int i=0;i<4;i++){ if(press(arr[i]) == 1) { start = arr[i]; break; } } ans = start; for(int i=0;i<4;i++) if(arr[i]!=start) v.push_back(arr[i]); assert(v.size() == 3); for(int i=0;i<N-2;i++){ int r = ans.length(); string tr = ""; tr += ans + v[0]; tr += ans + v[1] + v[0]; tr += ans + v[1] + v[1]; tr += ans + v[1] + v[2]; int x = press(tr); if(x == r) ans+=v[2]; else if(x == r+1) ans += v[0]; else ans += v[1]; } if(press(ans+v[0]) == N) return ans+v[0]; if(press(ans+v[1]) == N) return ans+v[1]; return ans+v[2]; } assert(1==0); return ""; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...