제출 #749655

#제출 시각아이디문제언어결과실행 시간메모리
749655tamyte콤보 (IOI18_combo)C++14
0 / 100
1 ms208 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; const string code = "ABXYY"; // int press(string s) { // int ans = 0; // // cerr << "a"; // for (int i = 0; i < s.size();) { // int j = i, ptr = 0; // while (j < s.size() && code[ptr] == s[j]) { // j++; ptr++; // } // i = max(j, i + 1); // // cerr << s << " " << ptr << "\n"; // ans = max(ans, ptr); // } // return ans; // } string guess_sequence(int N) { vector<char> el = {'A', 'B', 'X', 'Y'}; vector<char> fin; string ans = ""; string c = "AB"; if (!press(c)) { c = "XY"; } if (!press(c.substr(1))) { c = c[0]; } else { c = c[1]; } ans += c; for (auto u : el) { if (u != c[0]) { fin.push_back(u); } } for (int i = 2; i < N; ++i) { string guess = ans + fin[0] + fin[0] + ans + fin[0] + fin[1] + ans + fin[0] + fin[2] + ans + fin[1]; int num = press(guess); if (num == i - 1) { ans += fin[2]; } else if (num == i) { ans += fin[1]; } else { ans += fin[0]; } } if (N > 1) { string guess = ans + fin[0]; if (press(guess) == N) { ans += fin[0]; } guess = ans + fin[1]; if (press(guess) == N) { ans += fin[1]; } else { ans += fin[2]; } } return ans; } // int main () { // cout << guess_sequence(code.size()); // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...