Submission #318413

#TimeUsernameProblemLanguageResultExecution timeMemory
318413soroushCombo (IOI18_combo)C++14
100 / 100
56 ms564 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int n){ string ans = ""; vector < string > vec = {"A" , "B" , "X" , "Y"}; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); shuffle(vec.begin() , vec.end() , rng); string f = vec[0]; if(press(vec[0] + vec[1])){ if(press(vec[1])) f = vec[1]; } else{ if(press(vec[2])) f = vec[2]; else f = vec[3]; } ans += f; vector < string > v; for(int i = 0 ; i < 4 ; i ++){ auto s = vec.back(); vec.pop_back(); if(s!=f) v.push_back(s); } for(int i = 1 ; i < n-1 ; i ++){ int res = press(ans + v[0] + ans + v[1] + v[0] + ans + v[1] + v[1] + ans + v[1] + v[2]); if(res == i) ans += v[2]; if(res == i + 1) ans += v[0]; if(res == i + 2) ans += v[1]; } if(n == 1)return(ans); f = v[0]; if(press(ans + v[1]) == n) f = v[1]; else if(press(ans + v[2]) == n) f = v[2]; ans += f; return(ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...