제출 #434737

#제출 시각아이디문제언어결과실행 시간메모리
434737OttoTheDino콤보 (IOI18_combo)C++17
100 / 100
48 ms628 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define rep(i,s,e) for (int i = s; i <= e; ++i) #define rrep(i,s,e) for (int i = s; i >= e; --i) #define pb push_back #define pf push_front #define fi first #define se second #define all(a) a.begin(), a.end() typedef long long ll; typedef pair<int, int> ii; typedef vector<ii> vii; typedef vector<int> vi; typedef vector<double> vd; typedef vector<string> vs; typedef vector<char> vc; typedef vector<ll> vll; string guess_sequence(int n) { int ab = press("AB"), ax = press("AX"); string a = "ABXY"; if (ab>0 && ax==0) a = "BAXY"; else if (ab==0 && ax>0) a = "XABY"; else if (ab==0 && ax==0) a = "YABX"; string ans(1,a[0]); if (n==1) return ans; rep (i,1,n-2) { string s; rep (j,1,3) s += ans+a[1]+a[j]; s += ans+a[2]; int val = press(s); if (val==(int)ans.size()) ans += a[3]; else if (val==(int)ans.size()+1) ans += a[2]; else ans += a[1]; } if (press(ans+a[1]+ans+a[2])==n) { if (press(ans+a[1])==n) return ans+a[1]; return ans+a[2]; } return ans+a[3]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...