Submission #239295

#TimeUsernameProblemLanguageResultExecution timeMemory
239295Dremix10Combo (IOI18_combo)C++17
100 / 100
43 ms588 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define F first #define S second #define endl '\n' #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define maxp 22 #define EPS (ld)(1e-18) #define mod (int)(1e9+7) /// x = press(string s) for query string guess_sequence(int N) { int i,j; string s=""; char moves[4]={'A','B','X','Y'}; int one,alone,no,both; int x=press("AB"); if(x==0){ no=0; alone=1; x=press("X"); if(x==0){ one=3; both=2; } else{ one=2; both=3; } } else{ no=2; alone=3; x=press("A"); if(x==0){ one=1; both=0; } else{ one=0; both=1; } } s+=moves[one]; for(i=1;i<N-1;i++){ string p=s+moves[alone]; for(j=0;j<4;j++) if(j!=one) p+=s+moves[both]+moves[j]; int x=press(p); if(x==i) s+=moves[no]; else if(x==i+1) s+=moves[alone]; else s+=moves[both]; } if(N>1){ string p=s+moves[alone]+s+moves[no]; x=press(p); if(x==N-1) s+=moves[both]; else{ p=s+moves[alone]; x=press(p); if(x==N-1) s+=moves[no]; else s+=moves[alone]; } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...