제출 #991393

#제출 시각아이디문제언어결과실행 시간메모리
991393hirayuu_oj콤보 (IOI18_combo)C++17
100 / 100
23 ms1848 KiB
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<(n); i++) #define rep2(i,l,r) for(int i=(l); i<(r); i++) #define all(x) x.begin(),x.end() using ll=long long; constexpr ll LINF=(1LL<<62)-(1LL<<31); #include "combo.h" std::string guess_sequence(int N) { char fir; if(press("AB")){ if(press("A")){ fir='A'; } else{ fir='B'; } } else{ if(press("X")){ fir='X'; } else{ fir='Y'; } } string S=""; S+=fir; vector<string> use; for(string i:{"A","B","X","Y"}){ if(i!=S)use.emplace_back(i); } if(N==1)return S; rep(i,N-2){ string now=S+use[0]+S+use[1]+use[0]+S+use[1]+use[1]+S+use[1]+use[2]; int coin=press(now); if(coin==i+1){ S+=use[2]; } else if(coin==i+2){ S+=use[0]; } else{ S+=use[1]; } } if(press(S+use[1])==N){ S+=use[1]; } else{ if(press(S+use[2])==N){ S+=use[2]; } else{ S+=use[0]; } } return S; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...