Submission #275160

# Submission time Handle Problem Language Result Execution time Memory
275160 2020-08-20T04:42:52 Z khangal Split the Attractions (IOI19_split) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> pl;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define po pop_back
#define pb push_back
#define mk make_pair
#define mt make_tuple
#define lw lower_bound
#define up upper_bound
#define ff first
#define ss second
#define BOOST ios_base::sync_with_stdio(); cin.tie(0); cout.tie(0);
#define MOD 1000000007
#define MAX 1e18
#define MIN -1e18
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define per(i,a,b) for(ll i=b;i>=a;i--)
#define con continue
#define freopen freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define PI 3.14159265358979323846264338327950288419716939937510582097494459230781640628
#define read(x) scanf("%lld",&x);
#define print(x) printf("%lld ",x);
#define endl '\n';
// typedef tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// template< typename T>
// using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll n,m,ans,mid,mn,mx,T,sum,h1,h2,e[1234567],b[1234567],c[1234567],d[1<<20],k,i,j,l,r,h,a[1234567],w,x,y,z,res,par[1234567],cnt,sz[1234567];
bool used[1234567];
vl v[1234567],vec1;
char s1[1234567],s[1234567],ss[1234567];
vector<pl> vp[1234567];
bool ok;
map<ll,ll> mp;
ll c1[2234][2234],c2[1234][1234];
char ch[2234][2234];
ll dx[4]={0,0,1,-1},dy[4]={1,-1,0,0};
vl vec;
vector<int> vv1,vv2;
void dfs(int x,int p){
    sz[x]=1;
    par[x]=p;
    for(auto u:v[x]){
        if(p!=u)dfs(u,x),sz[x]+=sz[u];
    }
}
void dfs1(int x){
    used[x]=1;
    for(auto u:v[x]){
        if(used[u]==0&&par[u]==x)dfs(u);
    }
    vv1.pb(x);
}
void dfs1(int x){
    if(used[x]==1)return;
    for(auto u:v[x]){
        if(par[u]==x)dfs(u);
    }
    vv2.pb(x);
}
vector<int> find_split(int n,int a,int b,int c, vector<int>v1,vector<int>v2){
    rep(i,0,v1.size()-1){
        v[v1[i]].pb(v2[i]);
        v[v2[i]].pb(v1[i]);
    }
    dfs(0,-1);
    vector<pair<int,int>> vv({a,1},{b,2},{c,3});
    sort(vv.begin(),vv.end());
    rep(i,0,n-1){
        if(sz[i]>=vv[0].ff&&n-sz[i]>=vv[1].ff){
            dfs1(i);
            dfs2(0);
            rep(j,0,vv1.size()){
                if(j<vv[0].ss)ans[vv1[j]]=vv[0].ss;
                else ans[vv1[j]]=vv[2].ss;
            }
            rep(j,0,vv2.size()){
                if(j<vv[1].ss)ans[vv1[j]]=vv[1].ss;
                else ans[vv1[j]]=vv[2].ss;
            }
        }
        else{
            if(sz[i]>=vv[1].ff&&n-sz[i]>=vv[0].ff){
                dfs1(i);
                dfs2(0);
                rep(j,0,vv1.size()){
                    if(j<vv[1].ss)ans[vv1[j]]=vv[1].ss;
                    else ans[vv1[j]]=vv[2].ss;
                }
                rep(j,0,vv2.size()){
                    if(j<vv[0].ss)ans[vv1[j]]=vv[0].ss;
                    else ans[vv1[j]]=vv[2].ss;
                }
            }    
        }
    }
    return ans;
}

Compilation message

split.cpp: In function 'void dfs1(int)':
split.cpp:53:39: error: too few arguments to function 'void dfs(int, int)'
   53 |         if(used[u]==0&&par[u]==x)dfs(u);
      |                                       ^
split.cpp:43:6: note: declared here
   43 | void dfs(int x,int p){
      |      ^~~
split.cpp: At global scope:
split.cpp:57:6: error: redefinition of 'void dfs1(int)'
   57 | void dfs1(int x){
      |      ^~~~
split.cpp:50:6: note: 'void dfs1(int)' previously defined here
   50 | void dfs1(int x){
      |      ^~~~
split.cpp: In function 'void dfs1(int)':
split.cpp:60:27: error: too few arguments to function 'void dfs(int, int)'
   60 |         if(par[u]==x)dfs(u);
      |                           ^
split.cpp:43:6: note: declared here
   43 | void dfs(int x,int p){
      |      ^~~
split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:20:32: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 | #define rep(i,a,b) for(ll i=a;i<=b;i++)
......
   65 |     rep(i,0,v1.size()-1){
      |         ~~~~~~~~~~~~~~~         
split.cpp:65:5: note: in expansion of macro 'rep'
   65 |     rep(i,0,v1.size()-1){
      |     ^~~
split.cpp:70:47: error: no matching function for call to 'std::vector<std::pair<int, int> >::vector(<brace-enclosed initializer list>, <brace-enclosed initializer list>, <brace-enclosed initializer list>)'
   70 |     vector<pair<int,int>> vv({a,1},{b,2},{c,3});
      |                                               ^
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from split.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:650:2: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&)'
  650 |  vector(_InputIterator __first, _InputIterator __last,
      |  ^~~~~~
/usr/include/c++/9/bits/stl_vector.h:650:2: note:   template argument deduction/substitution failed:
split.cpp:70:47: note:   couldn't deduce template parameter '_InputIterator'
   70 |     vector<pair<int,int>> vv({a,1},{b,2},{c,3});
      |                                               ^
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from split.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:622:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::pair<int, int> >]'
  622 |       vector(initializer_list<value_type> __l,
      |       ^~~~~~
/usr/include/c++/9/bits/stl_vector.h:622:7: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/9/bits/stl_vector.h:604:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::pair<int, int> >]'
  604 |       vector(vector&& __rv, const allocator_type& __m)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_vector.h:604:7: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/9/bits/stl_vector.h:586:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::pair<int, int> >; std::false_type = std::integral_constant<bool, false>]'
  586 |       vector(vector&& __rv, const allocator_type& __m, false_type)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_vector.h:586:23: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<int, int> >&&'
  586 |       vector(vector&& __rv, const allocator_type& __m, false_type)
      |              ~~~~~~~~~^~~~
/usr/include/c++/9/bits/stl_vector.h:582:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::pair<int, int> >; std::true_type = std::integral_constant<bool, true>]'
  582 |       vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
      |       ^~~~~~
/usr/include/c++/9/bits/stl_vector.h:582:23: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<int, int> >&&'
  582 |       vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
      |              ~~~~~~~~~^~~~
/usr/include/c++/9/bits/stl_vector.h:572:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, const allocator_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::pair<int, int> >]'
  572 |       vector(const vector& __x, const allocator_type& __a)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_vector.h:572:7: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/9/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >]'
  569 |       vector(vector&&) noexcept = default;
      |       ^~~~~~
/usr/include/c++/9/bits/stl_vector.h:569:7: note:   candidate expects 1 argument, 3 provided
/usr/include/c++/9/bits/stl_vector.h:550:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >]'
  550 |       vector(const vector& __x)
      |       ^~~~~~
/usr/include/c++/9/bits/stl_vector.h:550:7: note:   candidate expects 1 argument, 3 provided
/usr/include/c++/9/bits/stl_vector.h:519:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const value_type&, const allocator_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::pair<int, int> >]'
  519 |       vector(size_type __n, const value_type& __value,
      |       ^~~~~~
/usr/include/c++/9/bits/stl_vector.h:519:24: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'}
  519 |       vector(size_type __n, const value_type& __value,
      |              ~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_vector.h:507:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::pair<int, int> >]'
  507 |       vector(size_type __n, const allocator_type& __a = allocator_type())
      |       ^~~~~~
/usr/include/c++/9/bits/stl_vector.h:507:7: note:   candidate expects 2 arguments, 3 provided
/usr/include/c++/9/bits/stl_vector.h:494:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<std::pair<int, int> >]'
  494 |       vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
      |       ^~~~~~
/usr/include/c++/9/bits/stl_vector.h:494:7: note:   candidate expects 1 argument, 3 provided
/usr/include/c++/9/bits/stl_vector.h:484:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >]'
  484 |       vector() = default;
      |       ^~~~~~
/usr/include/c++/9/bits/stl_vector.h:484:7: note:   candidate expects 0 arguments, 3 provided
split.cpp:75:13: error: 'dfs2' was not declared in this scope; did you mean 'dfs1'?
   75 |             dfs2(0);
      |             ^~~~
      |             dfs1
split.cpp:20:32: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 | #define rep(i,a,b) for(ll i=a;i<=b;i++)
......
   76 |             rep(j,0,vv1.size()){
      |                 ~~~~~~~~~~~~~~  
split.cpp:76:13: note: in expansion of macro 'rep'
   76 |             rep(j,0,vv1.size()){
      |             ^~~
split.cpp:77:41: error: invalid types 'll {aka long long int}[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   77 |                 if(j<vv[0].ss)ans[vv1[j]]=vv[0].ss;
      |                                         ^
split.cpp:78:32: error: invalid types 'll {aka long long int}[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   78 |                 else ans[vv1[j]]=vv[2].ss;
      |                                ^
split.cpp:20:32: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 | #define rep(i,a,b) for(ll i=a;i<=b;i++)
......
   80 |             rep(j,0,vv2.size()){
      |                 ~~~~~~~~~~~~~~  
split.cpp:80:13: note: in expansion of macro 'rep'
   80 |             rep(j,0,vv2.size()){
      |             ^~~
split.cpp:81:41: error: invalid types 'll {aka long long int}[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   81 |                 if(j<vv[1].ss)ans[vv1[j]]=vv[1].ss;
      |                                         ^
split.cpp:82:32: error: invalid types 'll {aka long long int}[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   82 |                 else ans[vv1[j]]=vv[2].ss;
      |                                ^
split.cpp:88:17: error: 'dfs2' was not declared in this scope; did you mean 'dfs1'?
   88 |                 dfs2(0);
      |                 ^~~~
      |                 dfs1
split.cpp:20:32: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 | #define rep(i,a,b) for(ll i=a;i<=b;i++)
......
   89 |                 rep(j,0,vv1.size()){
      |                     ~~~~~~~~~~~~~~
split.cpp:89:17: note: in expansion of macro 'rep'
   89 |                 rep(j,0,vv1.size()){
      |                 ^~~
split.cpp:90:45: error: invalid types 'll {aka long long int}[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   90 |                     if(j<vv[1].ss)ans[vv1[j]]=vv[1].ss;
      |                                             ^
split.cpp:91:36: error: invalid types 'll {aka long long int}[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   91 |                     else ans[vv1[j]]=vv[2].ss;
      |                                    ^
split.cpp:20:32: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 | #define rep(i,a,b) for(ll i=a;i<=b;i++)
......
   93 |                 rep(j,0,vv2.size()){
      |                     ~~~~~~~~~~~~~~
split.cpp:93:17: note: in expansion of macro 'rep'
   93 |                 rep(j,0,vv2.size()){
      |                 ^~~
split.cpp:94:45: error: invalid types 'll {aka long long int}[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   94 |                     if(j<vv[0].ss)ans[vv1[j]]=vv[0].ss;
      |                                             ^
split.cpp:95:36: error: invalid types 'll {aka long long int}[__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}]' for array subscript
   95 |                     else ans[vv1[j]]=vv[2].ss;
      |                                    ^
split.cpp:100:12: error: could not convert 'ans' from 'll' {aka 'long long int'} to 'std::vector<int>'
  100 |     return ans;
      |            ^~~
      |            |
      |            ll {aka long long int}