제출 #78708

#제출 시각아이디문제언어결과실행 시간메모리
78708wleung_bvg콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define f first
#define s second
#define all(a) (a).begin(),(a).end()
#define For(i,a,b) for(auto i=(a);i<(b);i++)
#define FOR(i,b) For(i,0,b)
#define Rev(i,a,b) for(auto i=(a);i>(b);i--)
#define REV(i,a) Rev(i,a,-1)
#define FORE(i,a) for(auto&&i:a)
#define sz(a) (int((a).size()))
using ll=long long;using ld=long double;using uint=unsigned int;using ull=unsigned long long;
using pii=pair<int,int>;using pll=pair<ll,ll>;using pill=pair<int,ll>;using plli=pair<ll,int>;using pdd=pair<double,double>;using pld=pair<ld,ld>;
constexpr const char nl='\n',sp=' ';constexpr const int INT_INF=0x3f3f3f3f;constexpr const ll LL_INF=0x3f3f3f3f3f3f3f3f;
constexpr const double D_INF=numeric_limits<double>::infinity();constexpr const ld LD_INF=numeric_limits<ld>::infinity();constexpr const double EPS=1e-9;

// int press(string p) {
//     cout << "?" << sp << p << nl;
//     cout.flush();
//     int x;
//     cin >> x;
//     return x;
// }

string guess_sequence(int N) {
    string S = press("AB") ? (press("A") ? "A" : "B") : (press("X") ? "X" : "Y");
    if (N == 1) return S;
    string ch = "";
    FORE(c, "ABXY") if (S[0] != c) ch.pb(c);
    For(i, 1, N - 1) S.pb(ch[press(S + ch[1] + S + ch[2] + ch[0] + S + ch[2] + ch[1] + S + ch[2] + ch[2]) - i]);
    return press(S + ch[0] + S + ch[1]) == N ? (press(S + ch[0]) == N ? S + ch[0] : S + ch[1]) : (S + ch[2]);
}

int main() {
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int N;
    cin >> N;
    cout << guess_sequence(N) << nl;
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:29:16: error: 'press' was not declared in this scope
   29 |     string S = press("AB") ? (press("A") ? "A" : "B") : (press("X") ? "X" : "Y");
      |                ^~~~~