제출 #293710

#제출 시각아이디문제언어결과실행 시간메모리
293710TheLorax콤보 (IOI18_combo)C++11
30 / 100
63 ms580 KiB
#include <bits/stdc++.h> #include "combo.h" #define F first #define S second #define SZ(a) ((int)(a).size()) #define PB push_back #define ALL(a) (a).begin(), (a).end() using namespace std; typedef long long ll; typedef pair<ll, ll> ii; std::string guess_sequence(int n) { std::string p = "AB"; int c = press(p); if(!c){ p="XY"; c=press(p); } std::string s; if(c==2) s=p; else if(c==1){ c=press(p.substr(0,1)); if(c) s+=p[0]; else s+=p[1]; } std::vector<char> a; for(auto x: {'A','B','X','Y'}) if(s[0]!=x) a.PB(x); while (SZ(s)<n) { p=s+a[0]; c=press(p); if(c==SZ(p)){ s+=a[0]; continue; } p=s+a[1]; c=press(p); if(c==SZ(p)) s+=a[1]; else s+=a[2]; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...