제출 #417882

#제출 시각아이디문제언어결과실행 시간메모리
417882LouayFarah콤보 (IOI18_combo)C++14
97 / 100
44 ms712 KiB
#include "bits/stdc++.h" #include "combo.h" using namespace std; #define pb push_back int press(string p); string guess_sequence(int n) { string res = ""; string temp = "ABXY"; for(int i = 0; i<3; i++) { string tr = ""; tr.pb(temp[i]); if(press(tr)==1) { res.pb(temp[i]); break; } } if(res.length()==0) res.pb('Y'); string used = ""; for(int i = 0; i<4; i++) { if(res[0]==temp[i]) continue; used.pb(temp[i]); } for(int i = 2; i<n; i++) { string s = ""; s = s + res + used[0]; s = s + res + used[1] + used[0]; s = s + res + used[1] + used[1]; s = s + res + used[1] + used[2]; int k = press(s); if(k==(int)res.length()) res.pb(used[2]); if(k==(int)res.length() + 1) res.pb(used[0]); if(k==(int)res.length()+2) res.pb(used[1]); } if((int)res.length()!=n) { string t = res + used[0]; if(press(t)==n) { res = res + used[0]; return res; } t = res + used[1]; if(press(t)==n) { res = res + used[1]; return res; } res = res + used[2]; return res; } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...