답안 #578094

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
578094 2022-06-16T04:36:24 Z tengiz05 The Potion of Great Power (CEOI20_potion) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "grader.cpp"

using namespace std;

constexpr int N = 1E5, B = 2, D = 2;
int h[N], n;
vector<pair<int, int>> mv[N];

void init(int N, int D, int H[]) {
    n = N;
    for (int i = 0; i < n; i++) {
        h[i] = H[i];
    }
}

void curseChanges(int U, int A[], int B[]) {
    for (int i = 0; i < U; i++) {
        mv[A[i]].emplace_back(i, B[i]);
        mv[B[i]].emplace_back(i, A[i]);
    }
    // for (int i = 0; i < n; i++) {
        // if (move[i].size() >= B) {
            
        // }
    // }
}

int question(int x, int y, int v) {
    multiset<int> a, ha;
    multiset<int> b, hb;
    for (int i = 0; i < int(mv[x].size()) && mv[x][i].first <= v; i++) {
        int g = mv[x][i].second;
        if (a.count(g)) {
            a.erase(g);
            ha.erase(ha.find(h[g]));
        } else {
            a.insert(g);
            ha.insert(h[g]);
        }
    }
    for (int i = 0; i < int(mv[y].size()) && mv[y][i].first <= v; i++) {
        int g = mv[y][i].second;
        if (b.count(g)) {
            b.erase(g);
            hb.erase(hb.find(h[g]));
        } else {
            b.insert(g);
            hb.insert(h[g]);
        }
    }
    vector<int> B(hb.begin(), hb.end());
    int i = 0;
    int ans = 1E9;
    for (auto x : ha) {
        while (i < int(B.size()) && B[i] < x)
            i++;
        if (i > 0) {
            ans = min(ans, x - B[i - 1]);
        }
        if (i < int(B.size())) {
            ans = min(ans, B[i] - x);
        }
    }
    return ans;
}

Compilation message

/usr/bin/ld: /tmp/cciq6ksa.o: in function `sigH(int)':
grader.cpp:(.text+0x0): multiple definition of `sigH(int)'; /tmp/ccGxiWkd.o:potion.cpp:(.text+0x0): first defined here
/usr/bin/ld: /tmp/cciq6ksa.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccGxiWkd.o:potion.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status