제출 #415275

#제출 시각아이디문제언어결과실행 시간메모리
415275Mohammed_Atalah콤보 (IOI18_combo)C++17
30 / 100
100 ms552 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { // cout << "expected: <= " << (2 * N) + 1 << endl; char cs[4] = {'A', 'B', 'X', 'Y'}; string res = ""; // char cant = '0'; // bool skip = false; string t1 = ""; t1 += cs[0]; t1 += cs[1]; if (press(t1) >= 1) { t1[1] = cs[0]; if (press(t1) == 1) { res += cs[0]; cs[0] = cs[3]; } else { res += cs [1]; cs[1] = cs[3]; } } else { string t2 = ""; t2 += cs[2]; t2 += cs[2]; if (press(t2) == 1) { res += cs[2]; cs[2] = cs[3]; } else { res += cs[3]; } } if (N == 1) { return res; } for (int i = 1; i < N; i++) { string check = res; check += cs[0]; check += res; check += cs[1]; if (press(check) == i + 1) { string check2 = res; check2 += cs[0]; if (press(check2) == i + 1) { res += cs[0]; } else { res += cs[1]; } } else { res += cs[2]; } } // cout << res << endl; return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...