제출 #167109

#제출 시각아이디문제언어결과실행 시간메모리
167109minseo852콤보 (IOI18_combo)C++11
5 / 100
1112 ms480 KiB
#include <combo.h> #include <bits/stdc++.h> #include <string> #include <vector> #include <iostream> using namespace std; string guess_sequence(int N) { string start; if (press("AB") >= 1) { start = (press("A") == 1 ? "A" : "B"); } else start = (press("X") == 1 ? "X" : "Y"); if (N == 1) return start; vector<string> others = { "A", "B", "X", "Y" }; for (int i = 0; i < 4; i++) if (others[i] == start) { others.erase(others.begin() + i); break; } string check; int count = 0; int digit = 1; string result; while (true) { check.clear(); for (int i = 0; i < 4; i++, count++) { check += start; digit = 1; for (int j = 0; j < N-1; digit*=3, j++) { check += others[count%(digit*3)/digit]; } } if (press(check) == N) { if (press(check.substr(0, 2 * N)) == N) { result = (press(check.substr(0, N)) == N ? check.substr(0, N) : check.substr(N, N)); } else { result = (press(check.substr(2 * N, N)) == N ? check.substr(2 * N, N) : check.substr(3 * N, N)); } break; } } return result; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...