제출 #508153

#제출 시각아이디문제언어결과실행 시간메모리
508153CasperWong콤보 (IOI18_combo)C++11
100 / 100
35 ms576 KiB
#include<bits/stdc++.h> #include"combo.h" using namespace std; std::string guess_sequence(int N) { long long n=N,x; string str="",temp; string ch[]={"A","B","X","Y"}; vector<string>posi={}; if(n==1){ for(auto i:ch){ if(i==ch[3]) return i; x=press(i); if(x==1) return i; } } x=press("AB"); if(x){ x=press("A"); if(x) str="A"; else str="B"; }else{ x=press("X"); if(x) str="X"; else str="Y"; } for(auto i:ch) if(i[0]!=str[0]) posi.push_back(i); for(int i=1;i<n-1;i++){ temp=""; for(auto i:posi){ temp+=str+posi[0]+i; } temp+=str+posi[1]; x=press(temp); if(x==i) str+=posi[2]; else if(x==i+1) str+=posi[1]; else str+=posi[0]; } for(auto i:posi){ if(i==posi[2]){ str+=i; break; } x=press(str+i); if(x==n){ str+=i; break; } } return str; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...