Submission #318402

#TimeUsernameProblemLanguageResultExecution timeMemory
318402soroushCombo (IOI18_combo)C++14
94 / 100
57 ms524 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int n){ string ans = ""; string f = "A"; if(press(ans + "B") == 1) f = "B"; else if(press(ans + "X") == 1) f = "X"; else if(press(ans + "Y") == 1) f = "Y"; ans += f; vector < string > v , vec = {"A" , "B" , "X" , "Y"}; 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 = "A"; if(press(ans + "B") == n) f = "B"; else if(press(ans + "X") == n) f = "X"; else if(press(ans + "Y") == n) f = "Y"; ans += f; return(ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...