Submission #421428

#TimeUsernameProblemLanguageResultExecution timeMemory
421428alireza_kavianiCombo (IOI18_combo)C++11
97 / 100
43 ms604 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 = ""; for(int i = 0 ; i < 3 ; i++){ if(press(vec[i]) == 1){ cur = vec[i]; break; } } if(cur.size() == 0) cur = vec[3]; 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...