Submission #424421

#TimeUsernameProblemLanguageResultExecution timeMemory
424421arnevesCombo (IOI18_combo)C++17
100 / 100
36 ms700 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; typedef long long ll; #define pb push_back #define f first #define s second #define all(x) x.begin(), x.end() const int MOD = 1'000'000'007; const int MX = 400'005; //long double PI = 3.14159265358979323846264338327950; const string k="ABXY"; int pergunta(string s){ int ans=0; int r=press(s+k[0]+s+k[1]); if(r==(int)s.length())ans+=2; r=press(s+k[0]+s+k[2]); if(r==(int)s.length())ans+=1; return ans; } string guess_sequence(int N) { int id[4]; string ans; for(int i=0; i<4; i++) id[i]=i; int y=pergunta(""); ans+=k[y]; if(N==1) return ans; swap(id[y],id[3]); for(int i=1; i<N-1; i++){ string perg; perg+=ans+k[id[1]]; perg+=ans+k[id[2]]+k[id[0]]; perg+=ans+k[id[2]]+k[id[1]]; perg+=ans+k[id[2]]+k[id[2]]; y=press(perg); if(y==(int)ans.length()){ ans+=k[id[0]]; }else if(y==(int)ans.length()+1){ ans+=k[id[1]]; }else{ ans+=k[id[2]]; } } y=pergunta(ans); ans+=k[y]; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...