제출 #234140

#제출 시각아이디문제언어결과실행 시간메모리
234140Binyomin콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
//#include "combo.h"

using namespace std ;

string guess_sequence(int N) {
    vector < char >  s, a = { 'A', 'B', 'X', 'Y' } ;
    char x ;
    string ans = "", p = "";
    int cnt = 1, ok = 1, cc;

    if( press("AB") ) {
        if( press("A") ) {
            ok =1 ;
            ans ="A";
            x = 'A';
            s = { 'B', 'X', 'Y'  } ;
        }
        else {
            ok =1 ;
            ans ="B";
            x = 'B';
            s = {'A', 'X', 'Y' };
        }
    }
    else {
        if( press("X") ) {
            ok =1 ;
            ans ="X";
            x = 'X';
            s = {'A', 'B', 'Y' };
        }
        else{
            ok =1 ;
            ans ="Y";
            x = 'Y';
            s = {'A', 'B', 'X'};
        }
    }

    while( cnt != N ) {
        p = ans + s[0] + ans + s[1] + ans + s[1] ;
        cc = press(p) ;
        if( cc == cnt + 2 ) {
            cnt ++ ;
            ans += s[1] ;
        }
        else if( cc == cnt + 1 ) {
            cnt ++ ;
            ans += s[0] ;
        }
        else {
            cnt ++ ;
            ans += s[2] ;
        }
    }

    return ans ;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:12:9: error: 'press' was not declared in this scope
   12 |     if( press("AB") ) {
      |         ^~~~~
combo.cpp:43:14: error: 'press' was not declared in this scope
   43 |         cc = press(p) ;
      |              ^~~~~