Submission #1022564

#TimeUsernameProblemLanguageResultExecution timeMemory
1022564Joshi503Combo (IOI18_combo)C++14
0 / 100
0 ms344 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string aux(string k, char car, string ca){ string ka=k; string k1=k; ka+=ca[0]; ka+=k; ka+=ca[1]; ka+=ca[0]; ka+=k; ka+=ca[1]; ka+=ca[1]; ka+=k; ka+=ca[1]; ka+=ca[2]; int res=press(ka); res-= k.length(); if(res == 2){ k1+=ca[1]; }else if(res == 1){ k1+=ca[0]; }else{ k1+=ca[2]; } return k1; } string guess_sequence(int n){ string ans="AB"; string k=""; if(press(ans) == 1){ ans="A"; if(press(ans) == 1){ k="A"; }else{ k="B"; } }else{ ans="X"; if(press(ans) == 1){ k="X"; }else{ k="Y"; } } char car= k[0]; string c="ABXY"; string ca="aaa"; int j=0; for(int i=0; i<4; i++){ if(c[i]==car){ continue; }else{ ca[j]=c[i]; j++; } } for(int i=1; i<n-1; i++){ k=aux(k,car,ca); } ans=k; string k1=k; k1+=ca[0]; k1+=k; k1+=ca[1]; if(press(k1) == (int)k.length() +1){ k1=k; k1+=ca[0]; if(press(k1) == (int)k.length() +1){ ans=k1; }else{ ans+=ca[1]; } }else{ ans+=ca[2]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...