제출 #1004166

#제출 시각아이디문제언어결과실행 시간메모리
1004166Gray콤보 (IOI18_combo)C++17
100 / 100
19 ms1756 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"; } } if (N==1) return ans; char start = ans[0]; vector<char> pos = {'A', 'B', 'X', 'Y'}; vector<char> chos; for (auto ch:pos) if (ch!=start) chos.push_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...