제출 #767828

#제출 시각아이디문제언어결과실행 시간메모리
767828Alihan_8Combo (IOI18_combo)C++17
컴파일 에러
0 ms0 KiB
//#include "combo.h"

#include <bits/stdc++.h>

using namespace std;

#define all(x) x.begin(), x.end()
#define pb push_back
#define ln '\n'
//#define int long long

#ifndef FILE
#include "grader.cpp"
#endif // FILE

template <class _T>
bool chmin(_T &x, const _T &y){
    bool flag = false;
    if ( x > y ){
        x = y; flag |= true;
    }
    return flag;
}

template <class _T>
bool chmax(_T &x, const _T &y){
    bool flag = false;
    if ( x < y ){
        x = y; flag |= true;
    }
    return flag;
}

string guess_sequence(int N){
    string s;
    if ( press("AB") ){
        s += press("A") ? 'A' : 'B';
    } else {
        s += press("X") ? 'X' : 'Y';
    }

    if ( N == 1 ){
        return s;
    }

    vector <char> R;

    for ( auto i: "ABXY" ){
        if ( s[0] != i ){
            R.pb(i);
        }
    }

    for ( int i = 2; i < N; i++ ){
        auto f = press(s + R[0] + s + R[1] + R[0] + s + R[1] + R[1] + s + R[1] + R[2]);
        if ( f == i - 1 ){
            s += R[2];
        } else if ( f == i ){
            s += R[0];
        } else{
            assert(f == i + 1);
            s += R[1];
        }
    }

    if ( press(s + R[0]) == N ){
        s += R[0];
    } else if ( press(s + R[1]) == N ){
        s += R[1];
    } else s += R[2];

    return s;
}

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

/usr/bin/ld: /tmp/ccPQURwI.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/ccGzmFLI.o:combo.cpp:(.text+0x0): first defined here
/usr/bin/ld: /tmp/ccPQURwI.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccGzmFLI.o:combo.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status