Submission #116946

# Submission time Handle Problem Language Result Execution time Memory
116946 2019-06-14T08:14:35 Z minhtung0404 ICC (CEOI16_icc) C++17
Compilation error
0 ms 0 KB
//https://oj.uz/problem/view/CEOI16_icc

#include<bits/stdc++.h>
#include "icc.h"
const int N = 105;
using namespace std;

int pset[N];

int find(int i) {return ((pset[i] == i) ? i : pset[i] = find(pset[i]));}

void dsu(int i, int j){
    i = find(i); j = find(j);
    if (i == j) return;
    pset[i] = j;
}

bool query(vector <int> &a, vector <int> &b){
    return query(a.size(), b.size(), a, b);
}

void find(vector <int>&a, vector <int>& b){
    if (a.size() == 1 && b.size() == 1) return;
    if (a.size() == 1 && b.size() != 1){
        find(b, a);
        return;
    }
    int siz = (int)a.size() / 2;
    vector <int> x;
    for (int i = 0; i < siz; i++) x.push_back(a[i]);
    if (query(x, b)){
        a = x;
    }
    else{
        x.clear();
        for (int i = siz; i < a.size(); i++) x.push_back(a[i]);
        a = x;
        find(a, b);
    }
}

void cal(vector <int>& a, vector <int>& b){
    find(a, b);
    setRoad(a[0], b[0]);
}

void run(int n){
    while (1){
        vector <int> A;
        for (int i = 1; i <= n; i++) if (pset[i] == i) A.push_back(i);
        for (int i = 1; (1 << i) <= n; i++){
            vector <int> a, b;
            for (auto j : A){
                if ((j >> i)&1){
                    a.push_back(j);
                }
                else{
                    b.push_back(j);
                }
            }
            if (query(a, b)){
                cal(a, b); break;
            }
        }
    }
}

Compilation message

icc.cpp: In function 'bool query(std::vector<int>&, std::vector<int>&)':
icc.cpp:19:42: error: no matching function for call to 'query(std::vector<int>::size_type, std::vector<int>::size_type, std::vector<int>&, std::vector<int>&)'
     return query(a.size(), b.size(), a, b);
                                          ^
In file included from icc.cpp:4:0:
icc.h:10:5: note: candidate: int query(int, int, int*, int*)
 int query(int a, int b, int *A, int *B);
     ^~~~~
icc.h:10:5: note:   no known conversion for argument 3 from 'std::vector<int>' to 'int*'
icc.cpp:18:6: note: candidate: bool query(std::vector<int>&, std::vector<int>&)
 bool query(vector <int> &a, vector <int> &b){
      ^~~~~
icc.cpp:18:6: note:   candidate expects 2 arguments, 4 provided
icc.cpp: In function 'void find(std::vector<int>&, std::vector<int>&)':
icc.cpp:36:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i = siz; i < a.size(); i++) x.push_back(a[i]);
                           ~~^~~~~~~~~~