답안 #524552

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
524552 2022-02-09T13:34:29 Z fabijan_cikac Minerals (JOI19_minerals) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

const int MAXN = (1 << 17);

#define F first
#define S second
#define pp pair<int, int>

vector<pp> sol;
deque<int> q;
int p[MAXN] = { 0 };

int Query(int x){
    int y; cin >> y;
    if (!p[x]) q.push_back(x);
    p[x] = !p[x]; return y;
}

void Answer(int x, int y){
    return;
}

void findpar(vector<int> v){
    if (v.size() == 2){
        sol.push_back({v[0], v[1]});
        return;
    }
    while (!q.empty()){
        if (p[q.front()]){
            Query(q.front()); p[q.front()] = 0;
        }
        q.pop_front();
    }
    vector<int> a[2]; int maks = v.size() / 4;
    for (int i = 0; i < v.size(); ++i){
        int x = Query(v[i]);
        if (x > maks){
            Query(v[i]); a[1].push_back(v[i]);
        }
        else a[0].push_back(v[i]);
    }
    findpar(a[0]); findpar(a[1]); return;
}

void Solve(int N){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> N;
    vector<int> v;
    for (int i = 0; i < 2 * N; ++i)
        v.push_back(i);
    findpar(v);
    for (int i = 0; i < N; ++i)
        Answer(sol[i].F + 1, sol[i].S + 1);
}

Compilation message

minerals.cpp: In function 'void findpar(std::vector<int>)':
minerals.cpp:37:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     for (int i = 0; i < v.size(); ++i){
      |                     ~~^~~~~~~~~~
/usr/bin/ld: /tmp/cccxG1NC.o: in function `Query(int)':
grader.cpp:(.text+0x30): multiple definition of `Query(int)'; /tmp/ccG0SDeG.o:minerals.cpp:(.text+0x0): first defined here
/usr/bin/ld: /tmp/cccxG1NC.o: in function `Answer(int, int)':
grader.cpp:(.text+0x100): multiple definition of `Answer(int, int)'; /tmp/ccG0SDeG.o:minerals.cpp:(.text+0x2e0): first defined here
collect2: error: ld returned 1 exit status