Submission #999668

#TimeUsernameProblemLanguageResultExecution timeMemory
999668cnn008Combo (IOI18_combo)C++17
5 / 100
1 ms596 KiB
#include "bits/stdc++.h" #include "combo.h" using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int rand(int l, int r){ assert(l<=r); return uniform_int_distribution<int> (l,r)(rng); } string guess_sequence(int n) { string cur,s; if(press("AB")){ if(press("A")) s="A",cur="BXY"; else s="B",cur="AXY"; }else{ if(press("X")) s="X",cur="ABY"; else s="Y",cur="ABX"; } for(int i=1; i<n-1; i++){ string _s=s+cur[0]+s+cur[1]+cur[0]+s+cur[1]+cur[1]+s+cur[1]+cur[2]; int _=press(_s); if(_==(int)s.size()) s+=cur[2]; else if(_==(int)s.size()+1) s+=cur[0]; else s+=cur[1]; } if(press(s+cur[0])==n) return s+cur[0]; else if(press(s+cur[1])==n) return s+cur[1]; return s+cur[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...