Submission #421432

#TimeUsernameProblemLanguageResultExecution timeMemory
421432alireza_kavianiCombo (IOI18_combo)C++11
100 / 100
56 ms496 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; vector<string> vec = {"A" , "B" , "X" , "Y"} , valid; string guess_sequence(int n){ string cur = ""; int res = 0; if(press(vec[1] + vec[3])) res |= 1; if(press(vec[2] + vec[3])) res |= 2; cur = vec[res]; if(n == 1) return cur; for(string i : vec){ if(i != cur){ valid.push_back(i); } } for(int i = 1 ; i + 1 < n ; i++){ string ask = cur + valid[1]; for(string j : valid) ask += cur + valid[2] + j; int res = press(ask); for(int j = 0 ; j < 3 ; j++){ if(res == i + j) cur += valid[j]; } } for(int i = 0 ; i < 2 ; i++){ if(press(cur + valid[i]) == n) return cur + valid[i]; } return cur + valid[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...