제출 #167107

#제출 시각아이디문제언어결과실행 시간메모리
167107minseo852콤보 (IOI18_combo)C++11
0 / 100
65 ms280 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"); 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...