Submission #446036

#TimeUsernameProblemLanguageResultExecution timeMemory
446036cs71107Combo (IOI18_combo)C++14
5 / 100
1 ms200 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; char val[10]; std::string guess_sequence(int N) { string AB = "AB"; string AX = "AX"; int ab = press(AB); int ax = press(AX); string ans = ""; char st = 0; if(ab&&ax){ ans = "A"; st = 'A'; val[0] = 'B'; val[1] = 'X'; val[2] = 'Y'; } else if(ab){ ans = "B"; st = 'B'; val[0] = 'A'; val[1] = 'X'; val[2] = 'Y'; } else if(ax){ ans = "X"; st = 'X'; val[0] = 'A'; val[1] = 'B'; val[2] = 'Y'; } else { ans = "Y"; st = 'Y'; val[0] = 'A'; val[1] = 'B'; val[2] = 'X'; } string tz = ""; string to = ""; string tt = ""; string oz = ""; tz += val[2]; tz += val[0]; to += val[2]; to += val[1]; tt += val[2]; tt += val[2]; oz += val[1]; oz += st; for(int i=1;i<N-1;i++){ string curs = ans+tz; curs+=(ans+to); curs+=(ans+tt); curs+=(ans+oz); int curv = press(curs); assert(curv<=i+2); ans+=val[curv-i]; } string ansz = ans+val[0]; string anso = ans+val[1]; if(press(ansz)==N){ ans+=val[0]; } else if(press(anso)==N){ ans+=val[1]; } else { ans+=val[2]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...