Submission #197719

#TimeUsernameProblemLanguageResultExecution timeMemory
197719kshitij_sodaniCombo (IOI18_combo)C++17
100 / 100
59 ms540 KiB
#include <iostream> #include <bits/stdc++.h> #include "combo.h" using namespace std; typedef long long int llo; #define mp make_pair #define pb push_back string guess_sequence(int n){ string s=""; int aa; if(n==1){ aa=press(s+"A"); if(aa==1){ return "A"; } else{ aa=press(s+"X"); if(aa==1){ return "X"; } else{ aa=press(s+"Y"); if(aa==1){ return "Y"; } else{ return "B"; } } } } aa=press(s+"AB"); if(aa>=1){ aa=press(s+"A"); if(aa==1){ s+="A"; } else{ s+="B"; } } else{ aa=press(s+"X"); if(aa==1){ s+="X"; } else{ s+="Y"; } } string b="B"; string x="X"; string y="Y"; if(s=="B"){ b="A"; } else if(s=="X"){ x="A"; } else if(s=="Y"){ y="A"; } for(int co=1;co<n-1;co++){ aa=press(s+b+s+x+y+s+x+x+s+x+b); if(aa==co){ s+=y; } else if(aa==co+1){ s+=b; } else{ s+=x; } } aa=press(s+b); if(aa==n){ s+=b; } else{ aa=press(s+x); if(aa==n){ s+=x; } else{ s+=y; } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...