제출 #908287

#제출 시각아이디문제언어결과실행 시간메모리
908287dragusanu_rares콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <iostream>
using namespace std;
string cunoscut;
char ch1,a,b,c;
inline void init(){
    if(ch1=='A'){
        a='B';
        b='X';
        c='Y';
    }
    else if(ch1=='B'){
        a='A';
        b='X';
        c='Y';
    }
    else if(ch1=='X'){
        a='A';
        b='B';
        c='Y';
    }
    else{
        a='A';
        b='B';
        c='X';
    }
}
inline void afla(){
    string guess=cunoscut+b+cunoscut+c+a+cunoscut+c+b+cunoscut+c+c;
    int x=press(guess)-cunoscut.size();
    if(x==0)cunoscut.push_back(a);
    else if(x==1)cunoscut.push_back(b);
    else cunoscut.push_back(c);
}
string guess_sequence(int n){
    if(n==1){
        if(press("X")==1)return "X";
        else if(press("Y")==1)return "Y";
        else if(press("A")==1)return "A";
        else return "B";
    }
    else{
        if(press("XY")>=1){
            if(press("X")==1)ch1='X';
            else ch1='Y';
        }
        else{
            if(press("A")==1)ch1='A';
            else ch1='B';
        }
        cunoscut=ch1;
        init();
        while(cunoscut.size()<n-1){
            afla();
        }
        if(press(cunoscut+a)==n)return cunoscut+a;
        else if(press(cunoscut+b)==n)return cunoscut+b;
        else return cunoscut+c;
    }
}
int32_t main(){
    return 0;
}

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

combo.cpp: In function 'void afla()':
combo.cpp:29:11: error: 'press' was not declared in this scope
   29 |     int x=press(guess)-cunoscut.size();
      |           ^~~~~
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:36:12: error: 'press' was not declared in this scope
   36 |         if(press("X")==1)return "X";
      |            ^~~~~
combo.cpp:42:12: error: 'press' was not declared in this scope
   42 |         if(press("XY")>=1){
      |            ^~~~~
combo.cpp:52:30: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   52 |         while(cunoscut.size()<n-1){
      |               ~~~~~~~~~~~~~~~^~~~
combo.cpp:55:12: error: 'press' was not declared in this scope
   55 |         if(press(cunoscut+a)==n)return cunoscut+a;
      |            ^~~~~
combo.cpp:59:1: warning: control reaches end of non-void function [-Wreturn-type]
   59 | }
      | ^