제출 #1272267

#제출 시각아이디문제언어결과실행 시간메모리
1272267jungle15콤보 (IOI18_combo)C++17
5 / 100
1 ms400 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); #define Jungle "IOI18_combo" #define getbit(x, i) (((x) >> (i)) & 1) #define MASK(i) (1 << (i)) #define cntbit __builtin_popcount template <typename t> void chkmin(t &a, t b) { if (a > b) a = b; } template <typename t> void chkmax(t &a, t b) { if (a < b) a = b; } string guess_sequence(int N) { string ans; if (press("AB")) { if (press("A")) ans = "A"; else ans = "B"; } else { if (press("X")) ans = "X"; else ans = "Y"; } vector<char> rem; for (char c : {'A','B','X','Y'}) if (c != ans[0]) rem.push_back(c); char b = rem[0], x = rem[1], y = rem[2]; for (int i = 1; i < N-1; i++) { string q; q.reserve(ans.size()*4+10); q += ans; q.push_back(b); q += ans; q.push_back(x); q.push_back(b); q += ans; q.push_back(x); q.push_back(x); q += ans; q.push_back(x); q.push_back(y); int res = press(q); if (res == (int)ans.size()+1) ans.push_back(b); else if (res == (int)ans.size()+2) ans.push_back(x); else ans.push_back(y); } for (char c : {b,x,y}) if (press(ans + c) == N) { ans.push_back(c); break; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...