Submission #432044

#TimeUsernameProblemLanguageResultExecution timeMemory
432044sikamax2019Combo (IOI18_combo)C++14
30 / 100
42 ms592 KiB
#include "combo.h" #include <iostream> #include <vector> #include <string> #include <algorithm> using namespace std; string guess_sequence(int N) { vector<char> ch; char c1, c2, c3; string cur = "A"; if (press(cur)) { c1 = 'B'; c2 = 'X'; c3 = 'Y'; } else { cur = "B"; if (press(cur)) { c1 = 'A'; c2 = 'X'; c3 = 'Y'; } else { cur = "X"; if (press(cur)) { c1 = 'A'; c2 = 'B'; c3 = 'Y'; } else { cur = "Y"; c1 = 'A'; c2 = 'B'; c3 = 'X'; } } } string s1=cur, s2=cur; for (int i = 2; i <= N; i++) { s1 = cur, s2 = cur; s1.push_back(c1); s2.push_back(c2); cur = s1 + s2; if (press(cur) == i) { if (press(s1) == i) cur = s1; else cur = s2; } else { s1.pop_back(); cur = s1; cur.push_back(c3); } } return cur; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...