Submission #767831

#TimeUsernameProblemLanguageResultExecution timeMemory
767831Alihan_8Combo (IOI18_combo)C++17
100 / 100
27 ms500 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() #define pb push_back #define ln '\n' //#define int long long #ifndef EVAL #include "grader.cpp" #endif template <class _T> bool chmin(_T &x, const _T &y){ bool flag = false; if ( x > y ){ x = y; flag |= true; } return flag; } template <class _T> bool chmax(_T &x, const _T &y){ bool flag = false; if ( x < y ){ x = y; flag |= true; } return flag; } string guess_sequence(int N){ string s; if ( press("AB") ){ s += press("A") ? 'A' : 'B'; } else{ s += press("X") ? 'X' : 'Y'; } if ( N == 1 ){ return s; } vector <char> R; for ( auto i: "ABXY" ){ if ( s[0] != i ){ R.pb(i); } } for ( int i = 2; i < N; i++ ){ auto f = press(s + R[0] + s + R[1] + R[0] + s + R[1] + R[1] + s + R[1] + R[2]); if ( f == i - 1 ){ s += R[2]; } else if ( f == i ){ s += R[0]; } else{ assert(f == i + 1); s += R[1]; } } if ( press(s + R[0]) == N ){ s += R[0]; } else if ( press(s + R[1]) == N ){ s += R[1]; } else{ s += R[2]; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...