Submission #318409

#TimeUsernameProblemLanguageResultExecution timeMemory
318409soroushCombo (IOI18_combo)C++14
97 / 100
47 ms536 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(ans + vec[1]) == 1) f = vec[1]; else if(press(ans + vec[2]) == 1) f = vec[2]; else if(press(ans + vec[3]) == 1) 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...