제출 #931998

#제출 시각아이디문제언어결과실행 시간메모리
931998ntmin콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#ifdef ntmin
    #include "combo.h";
#endif // ntmin

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
#define fi first
#define sc second

vector<string> p = {"A", "B", "X", "Y"};

#ifndef ntmin
int press(string s){
    cout << s << '\n';
    int t; cin >> t;
    return t;
}
#endif

string guess_sequence(int N){
    string ans = "";
    if(press("AB")){
        if(press("A"))
            ans = "A";
        else ans = "B";
    } else if(press("X")) ans = "X"; else ans = "Y";

    for(string& t : p){
        if(t == ans){
            swap(t, p[3]);
            p.pop_back();
            break;
        }
    }

    for(int i = 1; i < N; ++i){
        string tmp = ans + p[0] + p[0] + ans + p[0] + p[1] + ans + p[0] + p[2] + ans + p[1];

        if((int)tmp.size() > 4 * N){
            if(press(ans + p[0]) == i + 1) ans += p[0];
            else if(press(ans + p[1]) == i + 1) ans += p[1];
            else ans += p[2];
            continue;
        }

        int t = press(tmp);
        if(t == i + 2){
            ans.append(p[0]);
            continue;
        }
        if(t == i + 1){
            ans.append(p[1]);
            continue;
        }
        ans.append(p[2]);
    }
    return ans;
}

#ifndef ntmin
int main(){
    cout << guess_sequence(5);
}
#endif

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

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