Submission #233063

#TimeUsernameProblemLanguageResultExecution timeMemory
233063priyansh5525Combo (IOI18_combo)C++17
97 / 100
40 ms576 KiB
#include<bits/stdc++.h> #include "combo.h" using namespace std; #define ll int #define pii pair<long long int,long long int> #define vi vector<long long int > #define vvi vector<vector< long long int>> #define MP make_pair #define PB push_back #define pb pop_back #define PF push_front #define pf pop_front #define MOD 1000000007 string guess_sequence(ll n) { string ans=""; ll co=1; string a="B" , b="X" , c="Y"; if(press("A")==1) { ans="A"; } else if(press("B")==1) { ans = "B"; a="A"; } else if(press("X")==1) { ans= "X"; b="A"; } else { ans="Y"; c="A"; } if(n==1) return ans; while(co<n) { if(co==n-1) { if(press(ans+a)==co+1) { ans = ans+a; } else if(press(ans+b)==co+1) { ans = ans+b; } else ans =ans + c; co++; } else { string ex = ans+a+b+ans+a+a+ans+a+c+ans+b; ll check=press(ex); if(check>=co+2) ans+=a; else if(check==co+1) ans+=b; else ans+=c; co++; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...