Submission #1004141

#TimeUsernameProblemLanguageResultExecution timeMemory
1004141GrayCombo (IOI18_combo)C++17
5 / 100
1 ms344 KiB
#include<bits/stdc++.h> #include "combo.h" #define ll long long #define ff first #define ss second #define ln endl using namespace std; std::string guess_sequence(int N) { string ans=""; ll tmp = press("AABB"); if (tmp!=0){ tmp = press("AA"); if (tmp){ ans+="A"; }else ans+="B"; }else{ tmp = press("XX"); if (tmp){ ans+="X"; }else{ ans+="Y"; } } char start = ans[0]; vector<char> pos = {'A', 'B', 'X', 'Y'}; vector<char> chos; for (auto ch:pos) if (ch!=start) chos.emplace_back(ch); for (ll i=1;i<N-1; i++){ string ask = ans; ask+=chos[0]; for (auto ch:chos){ ask+=ans; ask+=chos[1]; ask+=ch; } ll ret = press(ask); if (ret==i+1){ ans+=chos[0]; }else if (ret==i+2){ ans+=chos[1]; }else ans+=chos[2]; } string ask = ans+chos[0]; ask+=ans; ask+=chos[1]; ll ret = press(ask); if (ret==N){ ret = press(ans+chos[0]); if (ret==N) ans+=chos[0]; else ans+=chos[1]; }else{ ans+=chos[2]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...