제출 #305360

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

char terms[4] = {'A', 'B', 'X', 'Y'};

std::string ans = "ABBXYXYYBYX";

int press(std::string p){

}

std::string guess_sequence(int N) {
    std::string p = "";
    std::string answer = "";
    std::vector <int> ok;
    int s = -1;
    p = answer + terms[0] + answer + terms[1];
    if(press(p) > 0){
        ok.push_back(2);
        ok.push_back(3);
        p = answer + terms[0];
        if(press(p) > 0){
            s = 0;
            ok.push_back(1);
        }
        else{
            s = 1;
            ok.push_back(0);
        }
    }
    else{
        ok.push_back(0);
        ok.push_back(1);
        p = answer + terms[2];
        if(press(p) > 0){
            s = 2;
            ok.push_back(3);
        }
        else{
            s = 3;
            ok.push_back(2);
        }
    }
    answer += terms[s];
    if(N == 1)
        return answer;
    for(int i = 1; i < N - 1; i++){
        p = answer + terms[ok[0]] + terms[ok[0]] + answer + terms[ok[0]] + terms[ok[1]] + answer + terms[ok[0]] + terms[ok[2]] + answer + terms[ok[1]];
        int count = press(p);
        if(count == i + 2){
            answer += terms[ok[0]];
        }
        else if(count == i + 1){
            answer += terms[ok[1]];
        }
        else{
            answer += terms[ok[2]];
        }
    }
    p = answer + terms[0] + answer + terms[1];
    if(press(p) == N){
        p = answer + terms[0];
        if(press(p) == N){
            answer += terms[0];
        }
        else{
            answer += terms[1];
        }
    }
    else{
        p = answer + terms[2];
        if(press(p) == N){
            answer += terms[2];
        }
        else{
            answer += terms[3];
        }
    }

    return answer;
}


int main(){
    
}

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

combo.cpp: In function 'int press(std::string)':
combo.cpp:10:1: warning: no return statement in function returning non-void [-Wreturn-type]
   10 | }
      | ^
/usr/bin/ld: /tmp/cc5AnT1c.o: in function `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
grader.cpp:(.text+0x0): multiple definition of `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'; /tmp/cc0hF5ff.o:combo.cpp:(.text.unlikely+0x0): first defined here
/usr/bin/ld: /tmp/cc5AnT1c.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc0hF5ff.o:combo.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status