Submission #303676

#TimeUsernameProblemLanguageResultExecution timeMemory
303676rocks03Combo (IOI18_combo)C++14
100 / 100
45 ms692 KiB
#include <bits/stdc++.h> using namespace std; string c[] = {"A", "B", "X", "Y"}; int press(string); string guess_sequence(int N){ string s = ""; if(press(c[0] + c[1])){ if(press(c[0])){ s = c[0]; swap(c[0], c[3]); } else{ s = c[1]; swap(c[1], c[3]); } } else if(press(c[2])){ s = c[2]; swap(c[2], c[3]); } else{ s = c[3]; } for(int i = 1; i < N; i++){ if(i == N-1){ if(press(s + c[0]) == N){ s += c[0]; break; } if(press(s + c[1]) == N){ s += c[1]; break; } s += c[2]; break; } string toask = (s + c[0] + c[0]) + (s + c[0] + c[1]) + (s + c[0] + c[2]) + (s + c[1]); int cur = press(toask); if(cur == i + 2){ s += c[0]; } else if(cur == i + 1){ s += c[1]; } else if(cur == i){ s += c[2]; } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...