Submission #768145

#TimeUsernameProblemLanguageResultExecution timeMemory
768145MarwenElarbiCombo (IOI18_combo)C++17
100 / 100
29 ms516 KiB
#include <bits/stdc++.h> #include "combo.h" #define optimise ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); using namespace std; #define vi vector<int> #define vl vector<long long> #define vii vector<pair<int,int>> #define pb push_back #define ll long long int #define fi first #define se second /*long long MOD=1e9+7; double PI=3.14159265359; int arx[8]={1,1,0,-1,-1,-1, 0, 1}; int ary[8]={0,1,1, 1, 0,-1,-1,-1};*/ string guess_sequence(int N) { string s=""; string a=""; string test="ABXY"; int block=-1; if (press("AB")>=1) { if(press("B")==1) block=1; else block=0; } else if(press("X")==1) block=2; else block=3; s+=test[block]; for (int i = 0; i < 4; ++i) { if(i==block)continue; a+=test[i]; } if(N==1) return s; for (int i = 1 ;i < N-1; ++i) { int k=press(s+a[0]+s+a[1]+a[0]+s+a[1]+a[1]+s+a[1]+a[2]); if (k-i==0) s+=a[2]; else if(k-i==1) s+=a[0]; else s+=a[1]; } if(press(s+a[0])==N) { s+=a[0]; return s; } else if(press(s+a[1])==N) { s+=a[1]; return s; } else { s+=a[2]; return s; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...