제출 #1270716

#제출 시각아이디문제언어결과실행 시간메모리
1270716OmarAlimammadzadeCombo (IOI18_combo)C++20
30 / 100
9 ms456 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "algo/debug" #else #define dbg(...) #endif mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); string guess_sequence(int N) { vector<string> buttons = { "A", "B", "X", "Y" }; string s; shuffle(buttons.begin(), buttons.end(), rng); s = buttons.back(); for (int i = 0; i < 3; i++) { if (press(buttons[i]) == 1) { s = buttons[i]; break; } } for (int i = 0; i < 4; i++) { if (buttons[i] == s) { buttons.erase(buttons.begin() + i); break; } } for (int i = 1; i < N; i++) { dbg(i); shuffle(buttons.begin(), buttons.end(), rng); string x = buttons.back(); for (int j = 0; j < 2; j++) { if (press(s + buttons[j]) == i + 1) { x = buttons[j]; break; } } s += x; } dbg(s); return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...