Submission #863677

# Submission time Handle Problem Language Result Execution time Memory
863677 2023-10-20T17:24:16 Z TahirAliyev ICC (CEOI16_icc) C++17
Compilation error
0 ms 0 KB
#include "icc.h"
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define pii pair<int, int>
#define oo 1e9

vector<vector<int>> comps;

int n;

void f(vector<int> a, vector<int>& b){
    while(b.size() != 1){
        vector<int> tmp;
        for(int i = 0; i <= (b.size() - 1) / 2; i++){
            tmp.push_back(b[i]);
        }
        if(query(a.size(), tmp.size(), a, tmp)){
            b = tmp;
        }
        else{
            for(int i : tmp){
                remove(b.begin(), b.end(), i);
            }
        }
    }
}

void run(int N){
    n = N;
    for(int i = 1; i <= n; i++){
        comps.push_back({i});
    }
    for(int z = 1; z < n; z++){
        vector<int> a, b;
        for(int j = 0; j < 8; j++){
            for(int i = 0; i < comps.size(); i++){
                if((1 << j) & i) a.push_back(i);
                else b.push_back(i);
            }
            if(query(a.size(), b.size(), a, b)) break;
            a.clear(), b.clear();
        }
        vector<int> v1, v2;
        for(int i : a){
            for(int j : comps[i]){
                v1.push_back(j); 
            }
        }
        for(int i : b){
            for(int j : comps[i]){
                v2.push_back(j); 
            }
        }
        f(v1, v2);
        f(v2, v1);
        int c1, c2;
        for(int i = 0; i < comps.size(); i++){
            for(int j : comps[i]){
                if(v1[0] == j) c1 = i;
                if(v2[0] == j) c2 = i;
            }
        }
        vector<int> v;
        v.swap(comps[c1]);
        for(int j : comps[c2]){
            v.push_back(j);
        }
        comps.erase(comps.begin() + c1);
        comps.erase(comps.begin() + c2);
        comps.push_back(v);
        setRoad(v1[0], v2[0]);
    }
}

Compilation message

icc.cpp: In function 'void f(std::vector<int>, std::vector<int>&)':
icc.cpp:17:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         for(int i = 0; i <= (b.size() - 1) / 2; i++){
      |                        ~~^~~~~~~~~~~~~~~~~~~~~
icc.cpp:20:40: error: cannot convert 'std::vector<int>' to 'int*'
   20 |         if(query(a.size(), tmp.size(), a, tmp)){
      |                                        ^
      |                                        |
      |                                        std::vector<int>
In file included from icc.cpp:1:
icc.h:10:30: note:   initializing argument 3 of 'int query(int, int, int*, int*)'
   10 | int query(int a, int b, int *A, int *B);
      |                         ~~~~~^
icc.cpp: In function 'void run(int)':
icc.cpp:39:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |             for(int i = 0; i < comps.size(); i++){
      |                            ~~^~~~~~~~~~~~~~
icc.cpp:43:42: error: cannot convert 'std::vector<int>' to 'int*'
   43 |             if(query(a.size(), b.size(), a, b)) break;
      |                                          ^
      |                                          |
      |                                          std::vector<int>
In file included from icc.cpp:1:
icc.h:10:30: note:   initializing argument 3 of 'int query(int, int, int*, int*)'
   10 | int query(int a, int b, int *A, int *B);
      |                         ~~~~~^
icc.cpp:60:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |         for(int i = 0; i < comps.size(); i++){
      |                        ~~^~~~~~~~~~~~~~