제출 #1305156

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