# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1138575 | Ekber_Ekber | 벽 (IOI14_wall) | C++20 | 컴파일 에러 | 0 ms | 0 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 30 | t[v*2].ma = max(t[v*2].ma, t[v*2].mi); | ^~~ wall.cpp:30:37: note: suggested alternatives: 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:2: /usr/include/c++/11/bits/stl_algo.h:3467:5: note: 'std::max' 3467 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ In file included from /usr/include/c++/11/algorithm:64, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65, from wall.cpp:2: /usr/include/c++/11/bits/ranges_algo.h:3011:29: note: 'std::ranges::max' 3011 | inline constexpr __max_fn max{}; | ^~~ 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 35 | t[v*2+1].ma = max(t[v*2+1].ma, t[v*2+1].mi); | ^~~ wall.cpp:35:39: note: suggested alternatives: 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:2: /usr/include/c++/11/bits/stl_algo.h:3467:5: note: 'std::max' 3467 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ In file included from /usr/include/c++/11/algorithm:64, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65, from wall.cpp:2: /usr/include/c++/11/bits/ranges_algo.h:3011:29: note: 'std::ranges::max' 3011 | inline constexpr __max_fn max{}; | ^~~ 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 43 | t[v*2].mi = min(t[v*2].mi, t[v*2].ma); | ^~~ wall.cpp:43:37: note: suggested alternatives: 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:2: /usr/include/c++/11/bits/stl_algo.h:3455:5: note: 'std::min' 3455 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ In file included from /usr/include/c++/11/algorithm:64, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65, from wall.cpp:2: /usr/include/c++/11/bits/ranges_algo.h:2957:29: note: 'std::ranges::min' 2957 | inline constexpr __min_fn min{}; | ^~~ 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 48 | t[v*2+1].mi = min(t[v*2+1].mi, t[v*2+1].ma); | ^~~ wall.cpp:48:39: note: suggested alternatives: 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:2: /usr/include/c++/11/bits/stl_algo.h:3455:5: note: 'std::min' 3455 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ In file included from /usr/include/c++/11/algorithm:64, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65, from wall.cpp:2: /usr/include/c++/11/bits/ranges_algo.h:2957:29: note: 'std::ranges::min' 2957 | inline constexpr __min_fn min{}; | ^~~ 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 59 | lazy[v].ma = max(lazy[v].ma, x); | ^~~ wall.cpp:59:38: note: suggested alternatives: 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:2: /usr/include/c++/11/bits/stl_algo.h:3467:5: note: 'std::max' 3467 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ In file included from /usr/include/c++/11/algorithm:64, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65, from wall.cpp:2: /usr/include/c++/11/bits/ranges_algo.h:3011:29: note: 'std::ranges::max' 3011 | inline constexpr __max_fn max{}; | ^~~ wall.cpp:67:32: error: 'min' was not declared in this scope 67 | update(v*2, tl, tm, l, min(r, tm), x); | ^~~ wall.cpp:67:32: note: suggested alternatives: 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:2: /usr/include/c++/11/bits/stl_algo.h:3455:5: note: 'std::min' 3455 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ In file included from /usr/include/c++/11/algorithm:64, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65, from wall.cpp:2: /usr/include/c++/11/bits/ranges_algo.h:2957:29: note: 'std::ranges::min' 2957 | inline constexpr __min_fn min{}; | ^~~ 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 68 | update(v*2+1, tm+1, tr, max(l, tm+1), r, x); | ^~~ wall.cpp:68:33: note: suggested alternatives: 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:2: /usr/include/c++/11/bits/stl_algo.h:3467:5: note: 'std::max' 3467 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ In file included from /usr/include/c++/11/algorithm:64, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65, from wall.cpp:2: /usr/include/c++/11/bits/ranges_algo.h:3011:29: note: 'std::ranges::max' 3011 | inline constexpr __max_fn max{}; | ^~~ 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 77 | lazy[v].mi = min(lazy[v].mi, x); | ^~~ wall.cpp:77:38: note: suggested alternatives: 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:2: /usr/include/c++/11/bits/stl_algo.h:3455:5: note: 'std::min' 3455 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ In file included from /usr/include/c++/11/algorithm:64, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65, from wall.cpp:2: /usr/include/c++/11/bits/ranges_algo.h:2957:29: note: 'std::ranges::min' 2957 | inline constexpr __min_fn min{}; | ^~~ wall.cpp:79:35: error: 'max' was not declared in this scope 79 | t[v].mi = max(t[v].ma, t[v].mi); | ^~~ wall.cpp:79:35: note: suggested alternatives: 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:2: /usr/include/c++/11/bits/stl_algo.h:3467:5: note: 'std::max' 3467 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ In file included from /usr/include/c++/11/algorithm:64, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65, from wall.cpp:2: /usr/include/c++/11/bits/ranges_algo.h:3011:29: note: 'std::ranges::max' 3011 | inline constexpr __max_fn max{}; | ^~~ wall.cpp:85:32: error: 'min' was not declared in this scope 85 | update(v*2, tl, tm, l, min(r, tm), x); | ^~~ wall.cpp:85:32: note: suggested alternatives: 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:2: /usr/include/c++/11/bits/stl_algo.h:3455:5: note: 'std::min' 3455 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ In file included from /usr/include/c++/11/algorithm:64, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65, from wall.cpp:2: /usr/include/c++/11/bits/ranges_algo.h:2957:29: note: 'std::ranges::min' 2957 | inline constexpr __min_fn min{}; | ^~~ 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 86 | update(v*2+1, tm+1, tr, max(l, tm+1), r, x); | ^~~ wall.cpp:86:33: note: suggested alternatives: 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:2: /usr/include/c++/11/bits/stl_algo.h:3467:5: note: 'std::max' 3467 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ In file included from /usr/include/c++/11/algorithm:64, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65, from wall.cpp:2: /usr/include/c++/11/bits/ranges_algo.h:3011:29: note: 'std::ranges::max' 3011 | inline constexpr __max_fn max{}; | ^~~ 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) { | ^~~~~