제출 #318406

#제출 시각아이디문제언어결과실행 시간메모리
318406soroush콤보 (IOI18_combo)C++14
97 / 100
48 ms576 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"}; random_shuffle(vec.begin() , vec.end()); 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...