답안 #313899

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
313899 2020-10-17T09:04:41 Z Fidisk 콤보 (IOI18_combo) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

#define oo 1e18
#define fi first
#define se second
#define sp(iiii) setprecision(iiii)
#define IO ios_base::sync_with_stdio(false); cin.tie(0)
#define ms(aaaa,xxxx) memset(aaaa,xxxx,sizeof(aaaa))
#define cntbit(xxxx) __builtin_popcount(xxxx)
#define getbit(xxxx,aaaa) ((xxxx>>(aaaa-1))&1)

typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pair<int,int>,int> piii;
typedef pair<long long,long long> pll;
typedef pair<pair<long long,long long>,long long> plll;

const ll mod=1e9+7;

char st,s1,s2,s3;
string ans;
int i,k;

string guess_sequence(int n) {
    if (press("AB")>0) {
        if (press("A")>0) {
            st='A';
        }
        else {
            st='B';
        }
    }
    else {
        if (press("X")>0) {
            st='X';
        }
        else {
            st='Y';
        }
    }
    if (st=='A') {
        s1='B';
        s2='X';
        s3='Y';
    }
    else if (st=='B') {
        s1='A';
        s2='X';
        s3='Y';
    }
    else if (st=='X') {
        s1='B';
        s2='A';
        s3='Y';
    }
    else if (st=='Y') {
        s1='B';
        s2='X';
        s3='A';
    }
    for (i=1;i<n-1;i++) {
        k=press(st+ans+s1+st+ans+s2+s1+st+ans+s2+s2+st+ans+s2+s3);
        if (k==(i+1)) {
            ans+=s1;
        }
        else if (k==(i+2)) {
            ans+=s2;
        }
        else {
            ans+=s3;
        }
    }
    if (press(st+ans+'A'+st+ans+'B')==n) {
        if (press(st+ans+'A')) {
            ans+='A';
        }
        else {
            ans+='B';
        }
    }
    else {
        if (press(st+ans+'X')) {
            ans+='X';
        }
        else {
            ans+='Y';
        }
    }
    return st+ans;
}

Compilation message

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:28:9: error: 'press' was not declared in this scope
   28 |     if (press("AB")>0) {
      |         ^~~~~
combo.cpp:65:11: error: 'press' was not declared in this scope
   65 |         k=press(st+ans+s1+st+ans+s2+s1+st+ans+s2+s2+st+ans+s2+s3);
      |           ^~~~~
combo.cpp:76:9: error: 'press' was not declared in this scope
   76 |     if (press(st+ans+'A'+st+ans+'B')==n) {
      |         ^~~~~