제출 #548582

#제출 시각아이디문제언어결과실행 시간메모리
548582beaconmcXylophone (JOI18_xylophone)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "xylophone.h"

typedef long long ll;
using namespace std;

#define FOR(i, x, y) for(ll i=x; i<y; i++)
#define FORNEG(i, x, y) for(ll i=x; i>y; i--)
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll int
ll twodiff[5001];
ll threediff[5001];

ll query(ll a,ll b){
    cout << a << " " << b;
    ll ans;
    cin >> ans;
    return ans;
}
void answer(ll a, ll b){
    cout << a << " " << b;
}

ll max(ll x[5001]){
    ll maxi = -1000000;
    FOR(i,0,5002){
        if (x[i]!=0){
            maxi = max(maxi, x[i]);
        }
    }

    return maxi;
}
ll min(ll x[5001]){
    ll mini = 1000000;
    FOR(i,0,5002){
        if (x[i]!=0){
            mini = min(mini, x[i]);
        }
    }
    return mini;
}

void solve(ll n){
    ll sussy[5001];
    FOR(i,0,5001){
        twodiff[i] = 0;
        threediff[i] = 0;
        sussy[i] = 0;
    }
    FOR(i,1,n){
        twodiff[i] = query(i, i+1);
    }
    FOR(i,1,n-1){
        threediff[i] = query(i, i+2);
    }

    FOR(i,2,n){
        if (threediff[i] == abs(twodiff[i-1]) + abs(twodiff[i])){
            twodiff[i] *= twodiff[i-1] / abs(twodiff[i-1]);
        }else{
            twodiff[i] *= -1*(twodiff[i-1] / abs(twodiff[i-1]));
        }
    }


    sussy[1] = twodiff[1];

    FOR(i,2,n){
        sussy[i] = sussy[i-1] + twodiff[i];
    }
    ll sus = min(sussy);
    FOR(i,0,n){
        sussy[i] -= sus-1;
    }
    FOR(i,0,n){
        answer(i+1, sussy[i]);
    }
}

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

/usr/bin/ld: /tmp/ccWcFkUW.o: in function `query(int, int)':
grader.cpp:(.text+0x0): multiple definition of `query(int, int)'; /tmp/cczlAa5T.o:xylophone.cpp:(.text+0x0): first defined here
/usr/bin/ld: /tmp/ccWcFkUW.o: in function `answer(int, int)':
grader.cpp:(.text+0xa0): multiple definition of `answer(int, int)'; /tmp/cczlAa5T.o:xylophone.cpp:(.text+0x80): first defined here
collect2: error: ld returned 1 exit status