Submission #342198

#TimeUsernameProblemLanguageResultExecution timeMemory
342198DoxenoCombo (IOI18_combo)C++11
100 / 100
46 ms592 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define fi first #define se second #define all(x) x.begin(),x.end() #define mp make_pair typedef long long ll; typedef vector<int> vi; typedef vector<ll> vll; typedef pair<int,int> pii; int press(string s); string guess_sequence(int N){ string s; s.resize(1); if(press ("XY") > 0){ if(press("X") > 0)s[0] = 'X'; else s[0] = 'Y'; }else{ if(press("A") > 0)s[0] = 'A'; else s[0] = 'B'; } vector<char> k = {'A','B','X','Y'}; for(int i = 1; i < 4; i++)if(k[i] == s[0]) swap(k[0],k[i]); for(int i = 1; i < N-1; i++){ string q = s; q+=k[1]; q+=s+k[2]+k[1]; q+=s+k[2]+k[2]; q+=s+k[2]+k[3]; int kek = press(q); if(kek == i){ s.pb(k[3]); }else if(kek == i+1){ s.pb(k[1]); }else{ s.pb(k[2]); } } if(N > 1){ if(press(s+k[1]) == N){ s.pb(k[1]); }else if(press(s+k[2]) == N){ s.pb(k[2]); }else{ s.pb(k[3]); } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...