제출 #1304941

#제출 시각아이디문제언어결과실행 시간메모리
1304941kaloyan콤보 (IOI18_combo)C++20
0 / 100
1 ms340 KiB
#include <iostream> #include <algorithm> #include <vector> #include <string> #include <cassert> using namespace std; int press(string p); string guess_sequence(int N) { string str, res; for(int i = 0 ; i < 4 * N ; ++i) { str.push_back('0'); } for(int i = 0 ; i < N ; ++i) { res.push_back('0'); } int cnt = 0; char head = '0'; for(char symbol : {'A', 'B', 'X', 'Y'}) { for(int j = 0 ; j < 4 * N ; ++j) { str[j] = symbol; } if(press(str) == 1) { head = symbol; cnt += 1; } } assert(cnt == 1); res[0] = head; for(int i = 1 ; i < N ; ++i) { str.clear(); for(char symbol : {'A', 'B', 'X', 'Y'}) { for(int j = 0 ; j <= i - 1 ; ++j) { str[j] = res[j]; } str[i] = symbol; for(int j = i + 1 ; j < 4 * N ; ++j) { str[j] = head; } if(press(str) == i + 1) { res[i] = symbol; break; } } } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...