Submission #568472

#TimeUsernameProblemLanguageResultExecution timeMemory
568472ngpin04Combo (IOI18_combo)C++17
100 / 100
32 ms648 KiB
#include "combo.h" #include <bits/stdc++.h> #define fi first #define se second #define mp make_pair #define TASK "" #define bit(x) (1LL << (x)) #define getbit(x, i) (((x) >> (i)) & 1) #define ALL(x) (x).begin(), (x).end() using namespace std; template <typename T1, typename T2> bool mini(T1 &a, T2 b) { if (a > b) {a = b; return true;} return false; } template <typename T1, typename T2> bool maxi(T1 &a, T2 b) { if (a < b) {a = b; return true;} return false; } mt19937_64 rd(chrono::steady_clock::now().time_since_epoch().count()); int rand(int l, int r) { return l + rd() % (r - l + 1); } // const int N = 1e5 + 5; const int oo = 1e9; const long long ooo = 1e18; const int mod = 1e9 + 7; // 998244353; const long double pi = acos(-1); #define ask press string guess_sequence(int N) { string a = "A", b = "B", x = "X", y = "Y"; if (ask(a + b)) { if (ask(b)) swap(a, b); } else { if (ask(x)) swap(a, x); else swap(a, y); } string s; s += a; for (int i = 1; i + 1 < N; i++) { string str = s + b + s + x + b + s + x + x + s + x + y; // cerr << str << "\n"; int res = ask(str); if (res == i) s += y; else if (res == i + 1) s += b; else s += x; } if (N > 1) { if (ask(s + b) == N) s += b; else if (ask(s + x) == N) s += x; else s += y; } return s; } //#include "grader.cpp"
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...