제출 #1138576

#제출 시각아이디문제언어결과실행 시간메모리
1138576Ekber_EkberWall (IOI14_wall)C++17
컴파일 에러
0 ms0 KiB
#include "wall.h" #include <bits/stdc++.h> #define ll long long #define itn int #define endl "\n" #define ff first #define ss second #define pb push_back #define ppb pop_back #define ins insert #define lb lower_bound #define ub upper_bound #define bs binary_search #define count1 __builtin_popcount #define all(v) v.begin(), v.end() struct point{ int ma, mi; }; constexpr int MAX = 2e+6 + 3, INF = 2e+9, MOD = 1e+9 + 7, K = log2(MAX); vector <point> t(4 * MAX, {0, 0}), lazy(4 * MAX, {-1, INF}); vector <int> h; void push(int v) { if (lazy[v].ma != -1) { if (t[v*2].mi < lazy[v].ma) { t[v*2].mi = lazy[v].ma; t[v*2].ma = max(t[v*2].ma, t[v*2].mi); lazy[v*2].ma = max(lazy[v*2].ma, lazy[v].ma); } if (t[v*2+1].mi < lazy[v].ma) { t[v*2+1].mi = lazy[v].ma; t[v*2+1].ma = max(t[v*2+1].ma, t[v*2+1].mi); lazy[v*2+1].ma = max(lazy[v*2+1].ma, lazy[v].ma); } lazy[v].ma = -1; } if (lazy[v].mi != INF) { if (t[v*2].ma > lazy[v].mi) { t[v*2].ma = lazy[v].mi; t[v*2].mi = min(t[v*2].mi, t[v*2].ma); lazy[v*2].mi = min(lazy[v*2].mi, lazy[v].mi); } if (t[v*2+1].ma > lazy[v].mi) { t[v*2+1].ma = lazy[v].mi; t[v*2+1].mi = min(t[v*2+1].mi, t[v*2+1].ma); lazy[v*2+1].mi = min(lazy[v*2+1].mi, lazy[v].mi); } lazy[v].mi = INF; } } void update1(int v, int tl, int tr, int l, int r, int x) { // increase if (l > r) return; if (tl == l && tr == r) { if (t[v].mi < x) { lazy[v].ma = max(lazy[v].ma, x); t[v].mi = x; t[v].ma = max(t[v].ma, t[v].mi); } return; } push(v); int tm = (tl + tr) / 2; update(v*2, tl, tm, l, min(r, tm), x); update(v*2+1, tm+1, tr, max(l, tm+1), r, x); t[v].ma = max(t[v*2].ma, t[v*2+1].ma); t[v].mi = min(t[v*2].mi, t[v*2+1].mi); } void update2(int v, int tl, int tr, int l, int r, int x) { // decrease if (l > r) return; if (tl == l && tr == r) { if (t[v].ma > x) { lazy[v].mi = min(lazy[v].mi, x); t[v].ma = x; t[v].mi = max(t[v].ma, t[v].mi); } return; } push(v); int tm = (tl + tr) / 2; update(v*2, tl, tm, l, min(r, tm), x); update(v*2+1, tm+1, tr, max(l, tm+1), r, x); t[v].ma = max(t[v*2].ma, t[v*2+1].ma); t[v].mi = min(t[v*2].mi, t[v*2+1].mi); } void build(int v, int tl, int tr) { if (tl == tr) { h.pb(t[v]); return; } int tm = (tl + tr) / 2; build(v*2, tl, tm); build(v*2+1, tm+1, tr); } void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){ for (int z=0; z < k; z++) { if (op[z] == 1) { update1(1, 0, n-1, left[z], right[z], height[z]); } else { update1(1, 0, n-1, left[z], right[z], height[z]); } } build(finalHeight); return; }

컴파일 시 표준 에러 (stderr) 메시지

wall.cpp:23:1: error: 'vector' does not name a type
   23 | vector <point> t(4 * MAX, {0, 0}), lazy(4 * MAX, {-1, INF});
      | ^~~~~~
wall.cpp:23:33: error: expected unqualified-id before ')' token
   23 | vector <point> t(4 * MAX, {0, 0}), lazy(4 * MAX, {-1, INF});
      |                                 ^
wall.cpp:23:59: error: expected unqualified-id before ')' token
   23 | vector <point> t(4 * MAX, {0, 0}), lazy(4 * MAX, {-1, INF});
      |                                                           ^
wall.cpp:24:1: error: 'vector' does not name a type
   24 | vector <int> h;
      | ^~~~~~
wall.cpp: In function 'void push(int)':
wall.cpp:27:13: error: 'lazy' was not declared in this scope
   27 |         if (lazy[v].ma != -1) {
      |             ^~~~
wall.cpp:28:21: error: 't' was not declared in this scope
   28 |                 if (t[v*2].mi < lazy[v].ma) {
      |                     ^
wall.cpp:30:37: error: 'max' was not declared in this scope; did you mean 'std::max'?
   30 |                         t[v*2].ma = max(t[v*2].ma, t[v*2].mi);
      |                                     ^~~
      |                                     std::max
In file included from /usr/include/c++/11/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from wall.cpp:2:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: 'std::max' declared here
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
wall.cpp:33:21: error: 't' was not declared in this scope
   33 |                 if (t[v*2+1].mi < lazy[v].ma) {
      |                     ^
wall.cpp:35:39: error: 'max' was not declared in this scope; did you mean 'std::max'?
   35 |                         t[v*2+1].ma = max(t[v*2+1].ma, t[v*2+1].mi);
      |                                       ^~~
      |                                       std::max
In file included from /usr/include/c++/11/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from wall.cpp:2:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: 'std::max' declared here
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
wall.cpp:40:13: error: 'lazy' was not declared in this scope
   40 |         if (lazy[v].mi != INF) {
      |             ^~~~
wall.cpp:41:21: error: 't' was not declared in this scope
   41 |                 if (t[v*2].ma > lazy[v].mi) {
      |                     ^
wall.cpp:43:37: error: 'min' was not declared in this scope; did you mean 'std::min'?
   43 |                         t[v*2].mi = min(t[v*2].mi, t[v*2].ma);
      |                                     ^~~
      |                                     std::min
In file included from /usr/include/c++/11/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from wall.cpp:2:
/usr/include/c++/11/bits/stl_algo.h:3455:5: note: 'std::min' declared here
 3455 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
wall.cpp:46:21: error: 't' was not declared in this scope
   46 |                 if (t[v*2+1].ma > lazy[v].mi) {
      |                     ^
wall.cpp:48:39: error: 'min' was not declared in this scope; did you mean 'std::min'?
   48 |                         t[v*2+1].mi = min(t[v*2+1].mi, t[v*2+1].ma);
      |                                       ^~~
      |                                       std::min
In file included from /usr/include/c++/11/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from wall.cpp:2:
/usr/include/c++/11/bits/stl_algo.h:3455:5: note: 'std::min' declared here
 3455 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
wall.cpp: In function 'void update1(int, int, int, int, int, int)':
wall.cpp:58:21: error: 't' was not declared in this scope
   58 |                 if (t[v].mi < x) {
      |                     ^
wall.cpp:59:25: error: 'lazy' was not declared in this scope
   59 |                         lazy[v].ma = max(lazy[v].ma, x);
      |                         ^~~~
wall.cpp:59:38: error: 'max' was not declared in this scope; did you mean 'std::max'?
   59 |                         lazy[v].ma = max(lazy[v].ma, x);
      |                                      ^~~
      |                                      std::max
In file included from /usr/include/c++/11/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from wall.cpp:2:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: 'std::max' declared here
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
wall.cpp:67:32: error: 'min' was not declared in this scope; did you mean 'std::min'?
   67 |         update(v*2, tl, tm, l, min(r, tm), x);
      |                                ^~~
      |                                std::min
In file included from /usr/include/c++/11/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from wall.cpp:2:
/usr/include/c++/11/bits/stl_algo.h:3455:5: note: 'std::min' declared here
 3455 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
wall.cpp:67:9: error: 'update' was not declared in this scope; did you mean 'update1'?
   67 |         update(v*2, tl, tm, l, min(r, tm), x);
      |         ^~~~~~
      |         update1
wall.cpp:68:33: error: 'max' was not declared in this scope; did you mean 'std::max'?
   68 |         update(v*2+1, tm+1, tr, max(l, tm+1), r, x);
      |                                 ^~~
      |                                 std::max
In file included from /usr/include/c++/11/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from wall.cpp:2:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: 'std::max' declared here
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
wall.cpp:69:9: error: 't' was not declared in this scope; did you mean 'tm'?
   69 |         t[v].ma = max(t[v*2].ma, t[v*2+1].ma);
      |         ^
      |         tm
wall.cpp: In function 'void update2(int, int, int, int, int, int)':
wall.cpp:76:21: error: 't' was not declared in this scope
   76 |                 if (t[v].ma > x) {
      |                     ^
wall.cpp:77:25: error: 'lazy' was not declared in this scope
   77 |                         lazy[v].mi = min(lazy[v].mi, x);
      |                         ^~~~
wall.cpp:77:38: error: 'min' was not declared in this scope; did you mean 'std::min'?
   77 |                         lazy[v].mi = min(lazy[v].mi, x);
      |                                      ^~~
      |                                      std::min
In file included from /usr/include/c++/11/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from wall.cpp:2:
/usr/include/c++/11/bits/stl_algo.h:3455:5: note: 'std::min' declared here
 3455 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
wall.cpp:79:35: error: 'max' was not declared in this scope; did you mean 'std::max'?
   79 |                         t[v].mi = max(t[v].ma, t[v].mi);
      |                                   ^~~
      |                                   std::max
In file included from /usr/include/c++/11/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from wall.cpp:2:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: 'std::max' declared here
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
wall.cpp:85:32: error: 'min' was not declared in this scope; did you mean 'std::min'?
   85 |         update(v*2, tl, tm, l, min(r, tm), x);
      |                                ^~~
      |                                std::min
In file included from /usr/include/c++/11/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from wall.cpp:2:
/usr/include/c++/11/bits/stl_algo.h:3455:5: note: 'std::min' declared here
 3455 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
wall.cpp:85:9: error: 'update' was not declared in this scope; did you mean 'update2'?
   85 |         update(v*2, tl, tm, l, min(r, tm), x);
      |         ^~~~~~
      |         update2
wall.cpp:86:33: error: 'max' was not declared in this scope; did you mean 'std::max'?
   86 |         update(v*2+1, tm+1, tr, max(l, tm+1), r, x);
      |                                 ^~~
      |                                 std::max
In file included from /usr/include/c++/11/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from wall.cpp:2:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: 'std::max' declared here
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
wall.cpp:87:9: error: 't' was not declared in this scope; did you mean 'tm'?
   87 |         t[v].ma = max(t[v*2].ma, t[v*2+1].ma);
      |         ^
      |         tm
wall.cpp: In function 'void build(int, int, int)':
wall.cpp:93:17: error: 'h' was not declared in this scope
   93 |                 h.pb(t[v]);
      |                 ^
wall.cpp:93:22: error: 't' was not declared in this scope
   93 |                 h.pb(t[v]);
      |                      ^
wall.cpp: In function 'void buildWall(int, int, int*, int*, int*, int*, int*)':
wall.cpp:110:15: error: invalid conversion from 'int*' to 'int' [-fpermissive]
  110 |         build(finalHeight);
      |               ^~~~~~~~~~~
      |               |
      |               int*
wall.cpp:110:14: error: too few arguments to function 'void build(int, int, int)'
  110 |         build(finalHeight);
      |         ~~~~~^~~~~~~~~~~~~
wall.cpp:91:6: note: declared here
   91 | void build(int v, int tl, int tr) {
      |      ^~~~~