Submission #1160831

#TimeUsernameProblemLanguageResultExecution timeMemory
1160831JahonaliXWall (IOI14_wall)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; struct segment_tree { int n; vector<int> mn, mx; segment_tree(int m) { n = m; mn.assign(n << 2, 0); mx.assign(n << 2, 1e9); } void push(int v, int l, int r) { if (l == r) return; mn[v << 1] = min(mn[v << 1], mx[v]); mn[v << 1 | 1] = min(mn[v << 1 | 1], mx[v]); mx[v << 1] = min(mx[v << 1], mx[v]); mx[v << 1 | 1] = min(mx[v << 1 | 1], mx[v]); mn[v << 1] = max(mn[v << 1], mn[v]); mn[v << 1 | 1] = max(mn[v << 1 | 1], mn[v]); mx[v << 1] = max(mx[v << 1], mn[v]); mx[v << 1 | 1] = max(mx[v << 1 | 1], mn[v]); mx[v] = 1e9; mn[v] = 0; } void min(int l, int r, int x, int v = 1, int tl = 0, int tr = -1) { if (tr < 0) tr += n; push(v, tl, tr); if (l <= tl && tr <= r) mx[v] = x; else { int m = (l + r) >> 1; if (r <= m) min(l, r, x, v << 1, tl, m); if (m < l) min(l, r, x, v << 1 | 1, m + 1, tr); } } void max(int l, int r, int x, int v = 1, int tl = 0, int tr = -1) { if (tr < 0) tr += n; push(v, tl, tr); if (l <= tl && tr <= r) mn[v] = x; else { int m = (l + r) >> 1; if (r <= m) max(l, r, x, v << 1, tl, m); if (m < l) max(l, r, x, v << 1 | 1, m + 1, tr); } } int get(int i, int v = 1, int l = 0, int r = -1) { if (r < 0) r += n; push(v, l, r); if (l == r) return mn[v]; int m = (l + r) >> 1; if (i > m) return get(i, v << 1 | 1, m + 1, r); else return get(i, v << 1, l, m); } }; void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]) { segment_tree s(n); for (int i = 0; i < k; ++i) { if (op[i] == 1) s.max(left[i], right[i], height[i]); else s.min(left[i], right[i], height[i]); } for (int i = 0; i < n; ++i) finalHeight[i] = s.get(i); }

Compilation message (stderr)

wall.cpp: In member function 'void segment_tree::push(int, int, int)':
wall.cpp:15:25: error: no matching function for call to 'segment_tree::min(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   15 |         mn[v << 1] = min(mn[v << 1], mx[v]);
      |                      ~~~^~~~~~~~~~~~~~~~~~~
wall.cpp:26:10: note: candidate: 'void segment_tree::min(int, int, int, int, int, int)'
   26 |     void min(int l, int r, int x, int v = 1, int tl = 0, int tr = -1) {
      |          ^~~
wall.cpp:26:10: note:   candidate expects 6 arguments, 2 provided
wall.cpp:16:29: error: no matching function for call to 'segment_tree::min(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   16 |         mn[v << 1 | 1] = min(mn[v << 1 | 1], mx[v]);
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~
wall.cpp:26:10: note: candidate: 'void segment_tree::min(int, int, int, int, int, int)'
   26 |     void min(int l, int r, int x, int v = 1, int tl = 0, int tr = -1) {
      |          ^~~
wall.cpp:26:10: note:   candidate expects 6 arguments, 2 provided
wall.cpp:17:25: error: no matching function for call to 'segment_tree::min(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   17 |         mx[v << 1] = min(mx[v << 1], mx[v]);
      |                      ~~~^~~~~~~~~~~~~~~~~~~
wall.cpp:26:10: note: candidate: 'void segment_tree::min(int, int, int, int, int, int)'
   26 |     void min(int l, int r, int x, int v = 1, int tl = 0, int tr = -1) {
      |          ^~~
wall.cpp:26:10: note:   candidate expects 6 arguments, 2 provided
wall.cpp:18:29: error: no matching function for call to 'segment_tree::min(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   18 |         mx[v << 1 | 1] = min(mx[v << 1 | 1], mx[v]);
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~
wall.cpp:26:10: note: candidate: 'void segment_tree::min(int, int, int, int, int, int)'
   26 |     void min(int l, int r, int x, int v = 1, int tl = 0, int tr = -1) {
      |          ^~~
wall.cpp:26:10: note:   candidate expects 6 arguments, 2 provided
wall.cpp:19:25: error: no matching function for call to 'segment_tree::max(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   19 |         mn[v << 1] = max(mn[v << 1], mn[v]);
      |                      ~~~^~~~~~~~~~~~~~~~~~~
wall.cpp:36:10: note: candidate: 'void segment_tree::max(int, int, int, int, int, int)'
   36 |     void max(int l, int r, int x, int v = 1, int tl = 0, int tr = -1) {
      |          ^~~
wall.cpp:36:10: note:   candidate expects 6 arguments, 2 provided
wall.cpp:20:29: error: no matching function for call to 'segment_tree::max(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   20 |         mn[v << 1 | 1] = max(mn[v << 1 | 1], mn[v]);
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~
wall.cpp:36:10: note: candidate: 'void segment_tree::max(int, int, int, int, int, int)'
   36 |     void max(int l, int r, int x, int v = 1, int tl = 0, int tr = -1) {
      |          ^~~
wall.cpp:36:10: note:   candidate expects 6 arguments, 2 provided
wall.cpp:21:25: error: no matching function for call to 'segment_tree::max(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   21 |         mx[v << 1] = max(mx[v << 1], mn[v]);
      |                      ~~~^~~~~~~~~~~~~~~~~~~
wall.cpp:36:10: note: candidate: 'void segment_tree::max(int, int, int, int, int, int)'
   36 |     void max(int l, int r, int x, int v = 1, int tl = 0, int tr = -1) {
      |          ^~~
wall.cpp:36:10: note:   candidate expects 6 arguments, 2 provided
wall.cpp:22:29: error: no matching function for call to 'segment_tree::max(__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&, __gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type&)'
   22 |         mx[v << 1 | 1] = max(mx[v << 1 | 1], mn[v]);
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~
wall.cpp:36:10: note: candidate: 'void segment_tree::max(int, int, int, int, int, int)'
   36 |     void max(int l, int r, int x, int v = 1, int tl = 0, int tr = -1) {
      |          ^~~
wall.cpp:36:10: note:   candidate expects 6 arguments, 2 provided