제출 #554095

#제출 시각아이디문제언어결과실행 시간메모리
554095d4xn콤보 (IOI18_combo)C++17
30 / 100
40 ms304 KiB
#include "combo.h" #pragma GCC optimize ("Ofast") #include <bits/stdc++.h> using namespace std; #define pb push_back string guess_sequence(int N) { string p; for (char i : {'A', 'B', 'X', 'Y'}) { p.pb(i); if (press(p)) { for (int j = 1; j < N; j++) { p.pb(i); } break; } p.pop_back(); } vector<char> v; for (char i : {'A', 'B', 'X', 'Y'}) { if (p[0] == i) continue; v.pb(i); } int idx = 1; while (idx < N) { for (int j = 0; j < 3; j++) { int k = j + rand() % (3 - j); swap(v[j], v[k]); } for (int i = idx+1; i - idx + 1 <= idx && i < N; i++) { p[i] = v[rand() % 3]; } for (char &i : v) { p[idx] = i; int x = press(p); if (x > idx) { idx = x; break; } } } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...