Submission #640158

#TimeUsernameProblemLanguageResultExecution timeMemory
640158ymmCombo (IOI18_combo)C++17
100 / 100
34 ms588 KiB
#include "combo.h" #include <bits/stdc++.h> #define Loop(x,l,r) for (ll x = (l); x < (r); ++x) #define LoopR(x,l,r) for (ll x = (r)-1; x >= (l); --x) typedef long long ll; typedef std::pair<int, int> pii; typedef std::pair<ll , ll > pll; using namespace std; #define INIT(x) do { swap(a[0], a[x]); s += a[0]; } while(0) std::string guess_sequence(int N) { string s = ""; char a[4] = {'A', 'B', 'X', 'Y'}; { if (press("AB")) if (press("A")) INIT(0); else INIT(1); else if (press("X")) INIT(2); else INIT(3); } if (N == 1) return s; Loop (i,1,N-1) { int x = press(s + a[2] + s + a[3] + a[1] + s + a[3] + a[2] + s + a[3] + a[3]) - i; if (x == 0) s += a[1]; else if (x == 1) s += a[2]; else /* if (x == 2) */ s += a[3]; } { if (press(s + a[1]) == N) s += a[1]; else if (press(s + a[2]) == N) s += a[2]; else s += a[3]; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...