Submission #1191291

#TimeUsernameProblemLanguageResultExecution timeMemory
1191291LolkasMeep벽 (IOI14_wall)C++20
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" using namespace std; typedef long long int ll; struct SeggsTree{ SeggsTree *l = 0, *r = 0; int low = 0, high = 0; struct Data{ ll mx, mn; Data() {mx = -(INT_MAX-1), mn = INT_MAX;} Data(ll X, ll N) {mx = X, mn = N;} void update(ll k){ mx = k, mn = k; } static Data merge(Data a, Data b){ return Data(max(a.mx, b.mx), min(a.mn, b.mn)); } }; Data d; SeggsTree(int L, int R){ low = L, high = R; if(R - L <= 1){ d = Data(0, 0); return; } int mid = low + (high - low) / 2; l = new SeggsTree(low, mid); r = new SeggsTree(mid, high); } ~SeggsTree(){ if(!l) return; delete l; delete r; } bool lazy = false; void push(){ if(!l) return; if(!lazy) return; l->d.mn = d.mn; l->d.mx = d.mx; l->lazy = true; r->d.mn = d.mn; r->d.mx = d.mx; r->lazy = true; lazy = false; } Data query(int L, int R){ if(R <= low || high <= L) return Data(); if(L <= low && high <= R) return d; push(); return Data::merge(l->query(L,R), r->query(L, R)); } void updateAdd(int L, int R, int k){ if(R <= low || high <= L || d.mn >= k) return; if(L <= low && high <= R && d.mx == d.mn){ d.update(max(d.mx, k)); lazy = true; return; } push(); l->updateAdd(L, R, k); r->updateAdd(L, R, k); d = Data::merge(l->d, r->d); } void updateSub(int L, int R, int k){ if(R <= low || high <= L || d.mx <= k) return; if(L <= low && high <= R && d.mn >= k){ d.update(min(d.mx, k)); lazy = true; return; } push(); l->updateSub(L, R, k); r->updateSub(L, R, k); d = Data::merge(l->d, r->d); } }; void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){ SeggsTree *tree = new SeggsTree(0, n); for(int i = 0; i < k; i++){ if(op[i] == 1) tree->updateAdd(left[i], right[i]+1, height[i]); else tree->updateSub(left[i], right[i]+1, height[i]); } for(int i = 0; i < n; i++) finalHeight[i] = tree->query(i, i+1).mn; } int main(){ }

Compilation message (stderr)

wall.cpp: In member function 'void SeggsTree::updateAdd(int, int, int)':
wall.cpp:69:25: error: no matching function for call to 'max(ll&, int&)'
   69 |             d.update(max(d.mx, k));
      |                      ~~~^~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from wall.cpp:1:
/usr/include/c++/11/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++/11/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
wall.cpp:69:25: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   69 |             d.update(max(d.mx, k));
      |                      ~~~^~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from wall.cpp:1:
/usr/include/c++/11/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++/11/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
wall.cpp:69:25: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   69 |             d.update(max(d.mx, k));
      |                      ~~~^~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from wall.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3461:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3461 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3461:5: note:   template argument deduction/substitution failed:
wall.cpp:69:25: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   69 |             d.update(max(d.mx, k));
      |                      ~~~^~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from wall.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3467:5: note:   template argument deduction/substitution failed:
wall.cpp:69:25: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   69 |             d.update(max(d.mx, k));
      |                      ~~~^~~~~~~~~
wall.cpp: In member function 'void SeggsTree::updateSub(int, int, int)':
wall.cpp:82:25: error: no matching function for call to 'min(ll&, int&)'
   82 |             d.update(min(d.mx, k));
      |                      ~~~^~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from wall.cpp:1:
/usr/include/c++/11/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++/11/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
wall.cpp:82:25: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   82 |             d.update(min(d.mx, k));
      |                      ~~~^~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from wall.cpp:1:
/usr/include/c++/11/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++/11/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
wall.cpp:82:25: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   82 |             d.update(min(d.mx, k));
      |                      ~~~^~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from wall.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3449:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3449 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3449:5: note:   template argument deduction/substitution failed:
wall.cpp:82:25: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   82 |             d.update(min(d.mx, k));
      |                      ~~~^~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from wall.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3455:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3455 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3455:5: note:   template argument deduction/substitution failed:
wall.cpp:82:25: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   82 |             d.update(min(d.mx, k));
      |                      ~~~^~~~~~~~~