Submission #661648

#TimeUsernameProblemLanguageResultExecution timeMemory
661648guagua0407벽 (IOI14_wall)C++17
Compilation error
0 ms0 KiB
/*
希望全國賽不要墊底
*/
#pragma GCC optimize("O4,unroll-loops,no-stack-protector")
#include <bits/stdc++.h>
#include <wall.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define f first
#define s second
#define all(x) x.begin(),x.end()
#define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

const ll mxh=0x3f3f3f3f;

struct node{
    int up=0,down=mxh;
};

const int mxn=2e6+5;
node segtree[8000080];

void push(int v){
    segtree[v*2].up=max(segtree[v*2].up,segtree[v].up);
    segtree[v*2].down=min(segtree[v*2].down,segtree[v].down);
    segtree[v*2].up=min(segtree[v*2].up,segtree[v].down);
    segtree[v*2].down=max(segtree[v*2].down,segtree[v].up);
    segtree[v*2+1].up=max(segtree[v*2+1].up,segtree[v].up);
    segtree[v*2+1].down=min(segtree[v*2+1].down,segtree[v].down);
    segtree[v*2+1].up=min(segtree[v*2+1].up,segtree[v].down);
    segtree[v*2+1].down=max(segtree[v*2+1].down,segtree[v].up);
    segtree[v].up=0;
    segtree[v].down=mxh;
}

void update(int type,int tl,int tr,ll h,int l,int r,int v=1){
    if(tl>tr){
        return;
    }
    if(tl<=l and r<=tr){
        if(type==1){
        	segtree[v].up=max(segtree[v].up,h);
        	segtree[v].down=max(segtree[v].down,h);
        }
        else{
        	segtree[v].down=min(segtree[v].down,h);
        	segtree[v].up=min(segtree[v].up,h);
        }
        return;
    }
    push(v);
    int mid=(l+r)/2;
    update(type,tl,min(mid,tr),h,l,mid,v*2);
    update(type,max(mid+1,tl),tr,h,mid+1,r,v*2+1);
}

ll query(int pos,int l,int r,int v=1){
    if(l==r){
        return min(segtree[v].up,segtree[v].down);
    } 
    push(v);
    int mid=(l+r)/2;
    if(pos<=mid) return query(pos,l,mid,v*2);
    else return query(pos,mid+1,r,v*2+1);
}

void buildWall(int n,int k,int op[],int l[],int r[],int h[], int final[]){
for(int i=0;i<k;i++){
        update(op[i],l[i],r[i],h[i],0,n-1);
    }
    for(int i=0;i<n;i++){
        final[i]=query(i,0,n-1);
    }
}

/*int main() {_
    //setIO("wayne");
	int op[6]={1,2,2,1,1,2};
	int l[6]={1,4,3,0,2,6};
	int r[6]={8,9,6,5,2,7};
	int h[6]={4,1,5,3,5,0};
	int final[10];
    buildWall(n,k,op,l,r,h,final);
    for(int i=0;i<n;i++){
        cout<<final[i]<<' ';
    }
    return 0;   
}*/
//maybe its multiset not set

Compilation message (stderr)

wall.cpp: In function 'void update(int, int, int, long long int, int, int, int)':
wall.cpp:43:43: error: no matching function for call to 'max(int&, long long int&)'
   43 |          segtree[v].up=max(segtree[v].up,h);
      |                                           ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from wall.cpp:5:
/usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
wall.cpp:43:43: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   43 |          segtree[v].up=max(segtree[v].up,h);
      |                                           ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from wall.cpp:5:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
wall.cpp:43:43: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   43 |          segtree[v].up=max(segtree[v].up,h);
      |                                           ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from wall.cpp:5:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
wall.cpp:43:43: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   43 |          segtree[v].up=max(segtree[v].up,h);
      |                                           ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from wall.cpp:5:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
wall.cpp:43:43: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   43 |          segtree[v].up=max(segtree[v].up,h);
      |                                           ^
wall.cpp:44:47: error: no matching function for call to 'max(int&, long long int&)'
   44 |          segtree[v].down=max(segtree[v].down,h);
      |                                               ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from wall.cpp:5:
/usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
wall.cpp:44:47: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   44 |          segtree[v].down=max(segtree[v].down,h);
      |                                               ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from wall.cpp:5:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
wall.cpp:44:47: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   44 |          segtree[v].down=max(segtree[v].down,h);
      |                                               ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from wall.cpp:5:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
wall.cpp:44:47: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   44 |          segtree[v].down=max(segtree[v].down,h);
      |                                               ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from wall.cpp:5:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
wall.cpp:44:47: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   44 |          segtree[v].down=max(segtree[v].down,h);
      |                                               ^
wall.cpp:47:47: error: no matching function for call to 'min(int&, long long int&)'
   47 |          segtree[v].down=min(segtree[v].down,h);
      |                                               ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from wall.cpp:5:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
wall.cpp:47:47: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   47 |          segtree[v].down=min(segtree[v].down,h);
      |                                               ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from wall.cpp:5:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
wall.cpp:47:47: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   47 |          segtree[v].down=min(segtree[v].down,h);
      |                                               ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from wall.cpp:5:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
wall.cpp:47:47: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   47 |          segtree[v].down=min(segtree[v].down,h);
      |                                               ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from wall.cpp:5:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
wall.cpp:47:47: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   47 |          segtree[v].down=min(segtree[v].down,h);
      |                                               ^
wall.cpp:48:43: error: no matching function for call to 'min(int&, long long int&)'
   48 |          segtree[v].up=min(segtree[v].up,h);
      |                                           ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from wall.cpp:5:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
wall.cpp:48:43: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   48 |          segtree[v].up=min(segtree[v].up,h);
      |                                           ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from wall.cpp:5:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
wall.cpp:48:43: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   48 |          segtree[v].up=min(segtree[v].up,h);
      |                                           ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from wall.cpp:5:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
wall.cpp:48:43: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   48 |          segtree[v].up=min(segtree[v].up,h);
      |                                           ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from wall.cpp:5:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
wall.cpp:48:43: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   48 |          segtree[v].up=min(segtree[v].up,h);
      |                                           ^