제출 #1091555

#제출 시각아이디문제언어결과실행 시간메모리
1091555AndreasK동굴 (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include <cave.h>

using namespace std;

#define designed ios_base::sync_with_stdio(0);
#define by cin.tie(0);
#define AndreasK cout.tie(0);
//#define int long long
#define ii pair <int, int>
#define vi vector <int>
#define iii pair <int, ii>
#define vii vector <ii>
#define vc vector <char>
#define vb vector <bool>

int n;

int tryCombination(int a[]) {
    for (int c = 0; c < n; c++)
        cout << a[c] << ' ';
    cout << '\n';
    int x;
    cin >> x;
    return x;
}

void answer(int a[], int b[]) {
    for (int c = 0; c < n; c++)
        cout << a[c] << ' ';
    cout << '\n';
    for (int c = 0; c < n; c++)
        cout << b[c] << ' ';
    cout << '\n';
}

void exploreCave(int n) {
    int a[n] = {}, b[n];
    stack <int> s;
    int x = tryCombination(a);
    if (x == -1)
        x = n;
    for (int c = 0; c < n; c++) {
        int prevx = x;
        a[c] ^= 1;
        x = tryCombination(a);
        if (x == -1)
            x = n;
        if (x > prevx) {
            while (!s.empty()) {
                a[s.top()] ^= 1;
                prevx = x;
                x = tryCombination(a);
                if (x == -1)
                    x = n;
                if (x <= prevx) {
                    a[s.top()] ^= 1;
                }
                else {
                    s.pop();
                }
            }
        }
        else if (x == prevx)
            s.push(c);
        else {
            a[c] ^= 1;
        }
    }
    for (int c = 0; c < n; c++) {
        a[c] ^= 1;
        x = tryCombination(a);
        a[c] ^= 1;
        b[c] = x;
    }
    answer(a, b);
}

int32_t main() {
    designed by AndreasK
    cin >> n;
    exploreCave(n);
    return 0;
}

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

/usr/bin/ld: /tmp/ccAoSo5x.o: in function `tryCombination':
cave.cpp:(.text+0x0): multiple definition of `tryCombination'; /tmp/ccgYjRey.o:grader.c:(.text+0x80): first defined here
/usr/bin/ld: /tmp/ccAoSo5x.o: in function `answer':
cave.cpp:(.text+0xc0): multiple definition of `answer'; /tmp/ccgYjRey.o:grader.c:(.text+0x0): first defined here
/usr/bin/ld: /tmp/ccAoSo5x.o: in function `main':
cave.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccgYjRey.o:grader.c:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status