Submission #760302

#TimeUsernameProblemLanguageResultExecution timeMemory
760302TrumlingCombo (IOI18_combo)C++14
100 / 100
23 ms696 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define pb push_back #define F first #define S second #define enter cout<<'\n'; #define INF 99999999999999999 #define MOD 1000000007 #define all(x) x.begin(),x.end() string guess_sequence(int N) { string dic[4]={"A","B","X","Y"}; ll first=-1; string p; for(int j=0;j<2*N;j++) p+=dic[0][0]; for(int j=0;j<2*N;j++) p+=dic[1][0]; ll ans=press(p); pair<int,int>possible; if(ans) { p=""; for(int j=0;j<4*N;j++) p+=dic[0][0]; ans=press(p); if(ans) first=0; else first=1; } else { p=""; for(int j=0;j<4*N;j++) p+=dic[2][0]; ans=press(p); if(ans) first=2; else first=3; } p=""; for(int i=0;i<4*N;i++) p+=dic[first][0]; for(int i=1;i<N-1;i++) { p[i]=dic[(first+1)%4][0]; for(int j=1;j<=3;j++) { p[i+j*N]=dic[(first+2)%4][0]; p[i+j*N+1]=dic[(first+j)%4][0]; } ans=press(p); if(ans==i+1) for(int j=0;j<=3;j++) p[i+j*N]=dic[(first+1)%4][0]; if(ans==i+2) for(int j=0;j<=3;j++) p[i+j*N]=dic[(first+2)%4][0]; if(ans==i) for(int j=0;j<=3;j++) p[i+j*N]=dic[(first+3)%4][0]; } if(N!=1) { for(int j=0;j<=3;j++) p[N-1+j*N]=dic[(first+1)%4][0]; ans=press(p); if(ans!=N) { p[N-1]=dic[(first+2)%4][0]; ans=press(p); if(ans!=N) p[N-1]=dic[(first+3)%4][0]; } } string answ; for(int i=0;i<N;i++) answ+=p[i]; // cout<<answ<<' '; return answ; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...