Submission #532193

# Submission time Handle Problem Language Result Execution time Memory
532193 2022-03-02T12:47:58 Z fabijan_cikac Minerals (JOI19_minerals) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

#include "minerals.h"

const int MAXN = (1 << 17);

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

vector<pp> sol;
int now = -1;

int query(int x){
    return now = Query(x);
}

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

void find_par(vector<int> a, vector<int> b){
    if (a.size() == 1){
        sol.push_back({a[0], b[0]}); return;
    }

    vector<int> v[2][2];
    for (int i = 0; i < a.size(); ++i){
        if (i < a.size() / 2)
            v[0][0].push_back(a[i]);
        else v[1][0].push_back(a[i]);
    }
    for (int i = 0; i < b.size(); ++i){
        int kop = now;
        if (kop == query(b[i]))
            v[0][1].push_back(b[i]);
        else v[1][1].push_back(b[i]);
         query(b[i]);
    }
    find_par(v[0][0], v[0][1]); find_par(v[1][0], v[1][1]);
}

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

    vector<int> a, b; int num = -1;
    for (int i = 1; i <= 2 * N; ++i){
        if (num == -1 || num != query(i))
            a.push_back(i);
        else{
            b.push_back(i); query(i);
        }
    }
    for (int i = 0; i < a.size(); ++i)
        query(a[i]);
    find_par(a, b);
    for (int i = 0; i < N; ++i)
        Answer(sol[i].F + 1, sol[i].S + 1);
}

Compilation message

minerals.cpp: In function 'void find_par(std::vector<int>, std::vector<int>)':
minerals.cpp:30:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |     for (int i = 0; i < a.size(); ++i){
      |                     ~~^~~~~~~~~~
minerals.cpp:31:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |         if (i < a.size() / 2)
      |             ~~^~~~~~~~~~~~~~
minerals.cpp:35:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |     for (int i = 0; i < b.size(); ++i){
      |                     ~~^~~~~~~~~~
minerals.cpp: In function 'void Solve(int)':
minerals.cpp:57:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |     for (int i = 0; i < a.size(); ++i)
      |                     ~~^~~~~~~~~~
/usr/bin/ld: /tmp/ccj2JE7I.o: in function `Answer(int, int)':
grader.cpp:(.text+0x100): multiple definition of `Answer(int, int)'; /tmp/cc06gS5J.o:minerals.cpp:(.text+0x20): first defined here
collect2: error: ld returned 1 exit status