Submission #113891

#TimeUsernameProblemLanguageResultExecution timeMemory
113891antimirageCombo (IOI18_combo)C++14
100 / 100
41 ms600 KiB
#include "combo.h" #include <bits/stdc++.h> //#include "grader.cpp" #define fr first #define sc second #define mk make_pair #define pb push_back #define all(s) s.begin(), s.end() using namespace std; string s; string guess_sequence (int n) { int res = press("AB"); char ch1, ch2, ch3; if (res){ if (press("A") ) s += 'A'; else s += 'B'; } else{ if (press("X") ) s += 'X'; else s += 'Y'; } if (s[0] == 'A') ch1 = 'B', ch2 = 'X', ch3 = 'Y'; if (s[0] == 'B') ch1 = 'A', ch2 = 'X', ch3 = 'Y'; if (s[0] == 'X') ch1 = 'B', ch2 = 'A', ch3 = 'Y'; if (s[0] == 'Y') ch1 = 'B', ch2 = 'X', ch3 = 'A'; for (int i = 1; i < n; i++) { if (i < n - 1){ int res = press( s + ch1 + s + ch2 + ch1 + s + ch2 + ch2 + s + ch2 + ch3 ) - i; if (res == 0) s += ch3; else if (res == 1) s += ch1; else s += ch2; } else{ int res = press(s + ch1) - i; if (res) s += ch1; else{ res = press(s + ch2) - i; if (res) s += ch2; else s += ch3; } } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...