제출 #131185

#제출 시각아이디문제언어결과실행 시간메모리
131185Blagojce콤보 (IOI18_combo)C++11
100 / 100
47 ms556 KiB
#include <bits/stdc++.h> #define fr(i, n, m) for(int i = (n); i < (m); i ++) #define pb push_back #define st first #define nd second #define pq priority_queue #define all(x) begin(x),end(x) #define what_is(x) cout<<#x<<' '<<x<<endl #include "combo.h" using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; ll const inf = 1e9; ll const mod = 1e9 + 7; ld const eps = 1e-9; string guess_sequence(int N) { string s = ""; if(press("AB") > 0){ if(press("A") == 1) s += 'A'; else s += 'B'; } else{ if(press("X") == 1) s += 'X'; else s += 'Y'; } if(N == 1) return s; vector<string> buttons = {"A", "B", "X", "Y"}; fr(i, 0, 4){ if(s == buttons[i]){ buttons.erase(buttons.begin() + i); break; } } string attach[4]; attach[0] = buttons[0] + buttons[0]; attach[1] = buttons[0] + buttons[1]; attach[2] = buttons[0] + buttons[2]; attach[3] = buttons[1]; int len = 1; fr(i, 1, N - 1){ int ans = press(s + attach[0] + s + attach[1] + s + attach[2] + s + attach[3]); if(ans == len) s += buttons[2]; else if(ans == len + 1) s += buttons[1]; else s += buttons[0]; len ++; } if(press(s + buttons[0] + s + buttons[1]) == N){ if(press(s + buttons[0]) == N){ s += buttons[0]; } else{ s += buttons[1]; } } else{ s += buttons[2]; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...