Submission #167120

#TimeUsernameProblemLanguageResultExecution timeMemory
167120minseo852Combo (IOI18_combo)C++11
5 / 100
722 ms424 KiB
#include <combo.h> #include <bits/stdc++.h> #include <string> #include <vector> #include <iostream> using namespace std; int countchar[2000] = { 0 }; void countup() { countchar[0] += 1; for (int i = 0; i < 1999; i++) { if (countchar[i] > 2) { countchar[i] = 0; countchar[i + 1] += 1; continue; } break; } } 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; string result; while (true) { check.clear(); for (int i = 0; i < 4; i++) { check += start; for (int j = 0; j < N-1; j++) { check += others[countchar[j]]; } countup(); } 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...