Submission #654784

#TimeUsernameProblemLanguageResultExecution timeMemory
654784atigunCombo (IOI18_combo)C++11
100 / 100
39 ms572 KiB
#include<bits/stdc++.h> #include"combo.h" using namespace std; typedef long long ll; string guess_sequence(int N){ map<int, string> M = {{1, "A"}, {2, "B"}, {3, "X"}, {4, "Y"}}; set<int> ava = {1, 2, 3, 4}; string s = ""; if(press("AB")){ if(press("A")){ s+= "A"; ava.erase(1); }else{ s+= "B"; ava.erase(2); } }else{ if(press("X")){ s+= "X"; ava.erase(3); }else{ s+= "Y"; ava.erase(4); } } vector<int> ch; for(int i : ava) ch.push_back(i); for(int i = 2; i <= N-1; i++){ string ask = s + M[ch[0]] + s + M[ch[1]]+M[ch[0]] + s + M[ch[1]]+M[ch[1]] + s + M[ch[1]]+M[ch[2]]; int ret = press(ask); if(ret == i){ s+= M[ch[0]]; }else if(ret == i+1){ s+= M[ch[1]]; }else if(ret == i-1){ s+= M[ch[2]]; } } if(N > 1){ if(press(s+M[ch[0]]) == N){ s+= M[ch[0]]; }else if(press(s+M[ch[1]]) == N){ s+= M[ch[1]]; }else{ s+= M[ch[2]]; } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...