Submission #706959

# Submission time Handle Problem Language Result Execution time Memory
706959 2023-03-08T07:37:23 Z socpite ICC (CEOI16_icc) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;

#define f first
#define s second

typedef long long ll;
typedef long double ld;

const int maxn = 105;
const int mod = 998244353;
 
int t, n;

int up[maxn];

int Find(int x){
    if(!up[x])return x;
    else return up[x] = Find(up[x]);
}

void Union(int a, int b){
    a = Find(a);
    b = Find(b);
    up[a] = b;
}

int arr1[maxn], arr2[maxn];

int gt(vector<int> a, vector<int> b){
    if(a.empty() || b.empty())return 0;
    for(int i = 0; i < a.size(); i++)arr1[i] = a[i];
    for(int i = 0; i < b.size(); i++)arr2[i] = b[i];
    return query(a.size(), b.size(), arr1, arr2);
}

int bs(vector<int> a, vector<int> b){
    int l = 0, r = a.size();
    while(l < r){
        int mid = (l+r+1)>>1;
        if(gt(vector<int>(a.begin(), a.begin()+mid), b))l = mid-1;
        else r = mid;
    }
    return a[l];
}

void findedge(vector<int> a, vector<int> b){
    assert(!a.empty() && !b.empty());
    int h1 = bs(a, b), h2 = bs(b, a);
    Union(h1, h2);
    setRoad(h1, h2);
}

void run(int N){
    n = N;
    for(int i = 1; i <= n; i++)up[i]=i;
    for(int i = 0; i < n-1; i++){
        for(int j = 0; j < 10; j++){
            vector<int> v[2];
            for(int k = 1; k <= n; k++)v[(Find(k)>>j)&1].push_back(k);
            if(gt(v[0], v[1])){
                findedge(v[0], v[1]);
                break;
            }
        }
    }
}

Compilation message

icc.cpp: In function 'int gt(std::vector<int>, std::vector<int>)':
icc.cpp:32:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     for(int i = 0; i < a.size(); i++)arr1[i] = a[i];
      |                    ~~^~~~~~~~~~
icc.cpp:33:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |     for(int i = 0; i < b.size(); i++)arr2[i] = b[i];
      |                    ~~^~~~~~~~~~
icc.cpp:34:12: error: 'query' was not declared in this scope
   34 |     return query(a.size(), b.size(), arr1, arr2);
      |            ^~~~~
icc.cpp: In function 'void findedge(std::vector<int>, std::vector<int>)':
icc.cpp:51:5: error: 'setRoad' was not declared in this scope
   51 |     setRoad(h1, h2);
      |     ^~~~~~~