답안 #318341

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
318341 2020-11-01T11:14:41 Z neki CEOI16_icc (CEOI16_icc) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "icc.h"

#define fore(i, a) for(auto&& i:a)
#define fi first
#define se second
#define ps(a) push_back(a)
#define pb(a) pop_back(a)
#define sc scanf
#define vc vector
#define pa pair<ll, ll>
#define ll int
#define loop(i, a, b) for(ll i=a;i<b;i++)
#define pool(i, a, b) for(ll i=a-1;i>=b;i--)
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(), a.end()
#define llmax LLONG_MAX/2
#define llmin -LLONG_MAX/2
using namespace std;
#define mn 200100
#define pa pair<ll, ll>
#define ld long double
vc<vc<ll>> dsu;
void run(int n){
    loop(i, 1, n+1) dsu.ps(vc<ll> {i});
    
    loop(cnt, 0, n-1){
        vc<pa> ints={make_pair(0, dsu.size())};
        vc<ll> a[2];
        do{
            vc<pa> ne;
            fore(v, ints){
                if(v.se-v.fi>1)ne.ps(make_pair(v.fi, (v.fi+v.se)/2)), ne.ps(make_pair((v.fi+v.se)/2, v.se));
                else ne.ps(v);
            }
            ints=ne;
            bool br=0;
            fore(v, ints){
                loop(j, v.fi, v.se) a[br].insert(a[br].end(), all(dsu[j]));
                br=!br;
            }
        }while(!query(a[0].size(), a[1].size(), a[0], a[1]));
        
        
        while(a[0].size()>1){
            vc<ll> b[2];
            loop(j, 0, a[0].size()) b[j<a[0].size()/2].ps(a[0][j]);
            if(query(a[1].size(), b[0].size(), a[1], b[0])) a[0]=b[0];
            else a[0]=b[1];
        }
        swap(a[0], a[1]);
        while(a[0].size()>1){
            vc<ll> b[2];
            loop(j, 0, a[0].size()) b[j<a[0].size()/2].ps(a[0][j]);
            if(query(a[1].size(), b[0].size(), a[1], b[0])) a[0]=b[0];
            else a[0]=b[1];
        }
        
        
        ll aa=a[0][0], ab=a[1][0];
        ll da, db;
        loop(j, 0, dsu.size()){
            fore(v, dsu[j]) if(v==aa)da=j;
            fore(v, dsu[j]) if(v==ab)db=j;
        }
        vc<ll> save=dsu[db];dsu.erase(dsu.begin()+db);
        dsu[ab].insert(dsu[ab].end(), all(save));
        setRoad(aa, ab);
    }
}

Compilation message

icc.cpp: In function 'void run(int)':
icc.cpp:43:52: error: cannot convert 'std::vector<int>' to 'int*'
   43 |         }while(!query(a[0].size(), a[1].size(), a[0], a[1]));
      |                                                 ~~~^
      |                                                    |
      |                                                    std::vector<int>
In file included from icc.cpp:2:
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:13:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 | #define loop(i, a, b) for(ll i=a;i<b;i++)
......
   48 |             loop(j, 0, a[0].size()) b[j<a[0].size()/2].ps(a[0][j]);
      |                  ~~~~~~~~~~~~~~~~~ 
icc.cpp:48:13: note: in expansion of macro 'loop'
   48 |             loop(j, 0, a[0].size()) b[j<a[0].size()/2].ps(a[0][j]);
      |             ^~~~
icc.cpp:48:40: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |             loop(j, 0, a[0].size()) b[j<a[0].size()/2].ps(a[0][j]);
      |                                       ~^~~~~~~~~~~~~~
icc.cpp:49:51: error: cannot convert 'std::vector<int>' to 'int*'
   49 |             if(query(a[1].size(), b[0].size(), a[1], b[0])) a[0]=b[0];
      |                                                ~~~^
      |                                                   |
      |                                                   std::vector<int>
In file included from icc.cpp:2:
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:13:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 | #define loop(i, a, b) for(ll i=a;i<b;i++)
......
   55 |             loop(j, 0, a[0].size()) b[j<a[0].size()/2].ps(a[0][j]);
      |                  ~~~~~~~~~~~~~~~~~ 
icc.cpp:55:13: note: in expansion of macro 'loop'
   55 |             loop(j, 0, a[0].size()) b[j<a[0].size()/2].ps(a[0][j]);
      |             ^~~~
icc.cpp:55:40: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |             loop(j, 0, a[0].size()) b[j<a[0].size()/2].ps(a[0][j]);
      |                                       ~^~~~~~~~~~~~~~
icc.cpp:56:51: error: cannot convert 'std::vector<int>' to 'int*'
   56 |             if(query(a[1].size(), b[0].size(), a[1], b[0])) a[0]=b[0];
      |                                                ~~~^
      |                                                   |
      |                                                   std::vector<int>
In file included from icc.cpp:2:
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:13:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 | #define loop(i, a, b) for(ll i=a;i<b;i++)
......
   63 |         loop(j, 0, dsu.size()){
      |              ~~~~~~~~~~~~~~~~      
icc.cpp:63:9: note: in expansion of macro 'loop'
   63 |         loop(j, 0, dsu.size()){
      |         ^~~~