# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
202098 | 2020-02-13T21:20:35 Z | maruii | Long Distance Coach (JOI17_coach) | C++14 | 컴파일 오류 |
0 ms | 0 KB |
coach#include <bits/stdc++.h>using namespace std;using ll = long long;using pii = pair<ll, ll>;#define ff first#define ss second int N, M;struct CHT { struct Node { pii L; int l, r; Node() : L(pii(0, 1e18)), l(-1), r(-1) {} } A[5000005]; ll f(pii L, int x) { return L.ff * x + L.ss; } int cnt; void update(int nn, int s, int e, pii L2) { pii &L1 = A[nn].L; if (f(L1, s) > f(L2, s)) swap(L1, L2); if (f(L1, e) <= f(L2, e)) return; int m = s + e >> 1; if (f(L1, m) >= f(L2, m)) { swap(L1, L2); if (A[nn].l < 0) A[nn].l = ++cnt, A[cnt].L = L1; update(A[nn].l, s, m, L2); } else { if (A[nn].r < 0) A[nn].r = ++cnt, A[cnt].L = L1; update(A[nn].r, m + 1, e, L2); } } void update(ll a, ll b) { update(0, 0, M, pii(a, b)); } ll query(int nn, int s, int e, int x) { if (nn < 0 || s > x || e < x) return 1e18; ll ret = f(A[nn].L, x); int m = s + e >> 1; return min({ret, query(A[nn].l, s, m, x), query(A[nn].r, m + 1, e, x)}); } ll query(int x) { return query(0, 0, M, x); }} cht;ll X, T, W;pii R[200005], P[200005];ll D[200005], H[200005], S[200005];int main() { ios_base::sync_with_stdio(0), cin.tie(0); cin >> X >> N >> M >> W >> T; for (int i = 0; i < N; ++i) { ll x; cin >> x; R[i] = {x % T, x / T}; } for (int i = 1; i <= M; ++i) cin >> P[i].ff >> P[i].ss; R[N] = {X % T, X / T}; sort(R, R + N + 1); sort(P + 1, P + M + 1); for (int i = 1; i <= M; ++i) { S[i] = S[i - 1] + P[i].ss; H[i] = X / T + (X % T >= P[i].ff); } H[0] = X / T + 1; for (int i = M, j = N; i; --i) { while (j >= 0 && R[j].ff > P[i].ff) { cht.update(-W * R[j].ss, D[i + 1] + S[i] + W * i * R[j].ss); --j; } D[i] = min(cht.query(i - 1) - S[i - 1], D[i + 1] + H[i] * W); } cout << D[1] + H[0] * W; return 0;}
Compilation message
coach.cpp:1:6: error: stray '#' in program coach#include <bits/stdc++.h>using namespace std;using ll = long long;using pii = pair<ll, ll>;#define ff first#define ss second int N, M;struct CHT { struct Node { pii L; int l, r; Node() : L(pii(0, 1e18)), l(-1), r(-1) {} } A[5000005]; ll f(pii L, int x) { return L.ff * x + L.ss; } int cnt; void update(int nn, int s, int e, pii L2) { pii &L1 = A[nn].L; if (f(L1, s) > f(L2, s)) swap(L1, L2); if (f(L1, e) <= f(L2, e)) return; int m = s + e >> 1; if (f(L1, m) >= f(L2, m)) { swap(L1, L2); if (A[nn].l < 0) A[nn].l = ++cnt, A[cnt].L = L1; update(A[nn].l, s, m, L2); } else { if (A[nn].r < 0) A[nn].r = ++cnt, A[cnt].L = L1; update(A[nn].r, m + 1, e, L2); } } void update(ll a, ll b) { update(0, 0, M, pii(a, b)); } ll query(int nn, int s, int e, int x) { if (nn < 0 || s > x || e < x) return 1e18; ll ret = f(A[nn].L, x); int m = s + e >> 1; return min({ret, query(A[nn].l, s, m, x), query(A[nn].r, m + 1, e, x)}); } ll query(int x) { return query(0, 0, M, x); }} cht;ll X, T, W;pii R[200005], P[200005];ll D[200005], H[200005], S[200005];int main() { ios_base::sync_with_stdio(0), cin.tie(0); cin >> X >> N >> M >> W >> T; for (int i = 0; i < N; ++i) { ll x; cin >> x; R[i] = {x % T, x / T}; } for (int i = 1; i <= M; ++i) cin >> P[i].ff >> P[i].ss; R[N] = {X % T, X / T}; sort(R, R + N + 1); sort(P + 1, P + M + 1); for (int i = 1; i <= M; ++i) { S[i] = S[i - 1] + P[i].ss; H[i] = X / T + (X % T >= P[i].ff); } H[0] = X / T + 1; for (int i = M, j = N; i; --i) { while (j >= 0 && R[j].ff > P[i].ff) { cht.update(-W * R[j].ss, D[i + 1] + S[i] + W * i * R[j].ss); --j; } D[i] = min(cht.query(i - 1) - S[i - 1], D[i + 1] + H[i] * W); } cout << D[1] + H[0] * W; return 0;} ^ coach.cpp:1:96: error: stray '#' in program coach#include <bits/stdc++.h>using namespace std;using ll = long long;using pii = pair<ll, ll>;#define ff first#define ss second int N, M;struct CHT { struct Node { pii L; int l, r; Node() : L(pii(0, 1e18)), l(-1), r(-1) {} } A[5000005]; ll f(pii L, int x) { return L.ff * x + L.ss; } int cnt; void update(int nn, int s, int e, pii L2) { pii &L1 = A[nn].L; if (f(L1, s) > f(L2, s)) swap(L1, L2); if (f(L1, e) <= f(L2, e)) return; int m = s + e >> 1; if (f(L1, m) >= f(L2, m)) { swap(L1, L2); if (A[nn].l < 0) A[nn].l = ++cnt, A[cnt].L = L1; update(A[nn].l, s, m, L2); } else { if (A[nn].r < 0) A[nn].r = ++cnt, A[cnt].L = L1; update(A[nn].r, m + 1, e, L2); } } void update(ll a, ll b) { update(0, 0, M, pii(a, b)); } ll query(int nn, int s, int e, int x) { if (nn < 0 || s > x || e < x) return 1e18; ll ret = f(A[nn].L, x); int m = s + e >> 1; return min({ret, query(A[nn].l, s, m, x), query(A[nn].r, m + 1, e, x)}); } ll query(int x) { return query(0, 0, M, x); }} cht;ll X, T, W;pii R[200005], P[200005];ll D[200005], H[200005], S[200005];int main() { ios_base::sync_with_stdio(0), cin.tie(0); cin >> X >> N >> M >> W >> T; for (int i = 0; i < N; ++i) { ll x; cin >> x; R[i] = {x % T, x / T}; } for (int i = 1; i <= M; ++i) cin >> P[i].ff >> P[i].ss; R[N] = {X % T, X / T}; sort(R, R + N + 1); sort(P + 1, P + M + 1); for (int i = 1; i <= M; ++i) { S[i] = S[i - 1] + P[i].ss; H[i] = X / T + (X % T >= P[i].ff); } H[0] = X / T + 1; for (int i = M, j = N; i; --i) { while (j >= 0 && R[j].ff > P[i].ff) { cht.update(-W * R[j].ss, D[i + 1] + S[i] + W * i * R[j].ss); --j; } D[i] = min(cht.query(i - 1) - S[i - 1], D[i + 1] + H[i] * W); } cout << D[1] + H[0] * W; return 0;} ^ coach.cpp:1:112: error: stray '#' in program coach#include <bits/stdc++.h>using namespace std;using ll = long long;using pii = pair<ll, ll>;#define ff first#define ss second int N, M;struct CHT { struct Node { pii L; int l, r; Node() : L(pii(0, 1e18)), l(-1), r(-1) {} } A[5000005]; ll f(pii L, int x) { return L.ff * x + L.ss; } int cnt; void update(int nn, int s, int e, pii L2) { pii &L1 = A[nn].L; if (f(L1, s) > f(L2, s)) swap(L1, L2); if (f(L1, e) <= f(L2, e)) return; int m = s + e >> 1; if (f(L1, m) >= f(L2, m)) { swap(L1, L2); if (A[nn].l < 0) A[nn].l = ++cnt, A[cnt].L = L1; update(A[nn].l, s, m, L2); } else { if (A[nn].r < 0) A[nn].r = ++cnt, A[cnt].L = L1; update(A[nn].r, m + 1, e, L2); } } void update(ll a, ll b) { update(0, 0, M, pii(a, b)); } ll query(int nn, int s, int e, int x) { if (nn < 0 || s > x || e < x) return 1e18; ll ret = f(A[nn].L, x); int m = s + e >> 1; return min({ret, query(A[nn].l, s, m, x), query(A[nn].r, m + 1, e, x)}); } ll query(int x) { return query(0, 0, M, x); }} cht;ll X, T, W;pii R[200005], P[200005];ll D[200005], H[200005], S[200005];int main() { ios_base::sync_with_stdio(0), cin.tie(0); cin >> X >> N >> M >> W >> T; for (int i = 0; i < N; ++i) { ll x; cin >> x; R[i] = {x % T, x / T}; } for (int i = 1; i <= M; ++i) cin >> P[i].ff >> P[i].ss; R[N] = {X % T, X / T}; sort(R, R + N + 1); sort(P + 1, P + M + 1); for (int i = 1; i <= M; ++i) { S[i] = S[i - 1] + P[i].ss; H[i] = X / T + (X % T >= P[i].ff); } H[0] = X / T + 1; for (int i = M, j = N; i; --i) { while (j >= 0 && R[j].ff > P[i].ff) { cht.update(-W * R[j].ss, D[i + 1] + S[i] + W * i * R[j].ss); --j; } D[i] = min(cht.query(i - 1) - S[i - 1], D[i + 1] + H[i] * W); } cout << D[1] + H[0] * W; return 0;} ^ coach.cpp:1:129: error: stray '\302' in program coach#include <bits/stdc++.h>using namespace std;using ll = long long;using pii = pair<ll, ll>;#define ff first#define ss second int N, M;struct CHT { struct Node { pii L; int l, r; Node() : L(pii(0, 1e18)), l(-1), r(-1) {} } A[5000005]; ll f(pii L, int x) { return L.ff * x + L.ss; } int cnt; void update(int nn, int s, int e, pii L2) { pii &L1 = A[nn].L; if (f(L1, s) > f(L2, s)) swap(L1, L2); if (f(L1, e) <= f(L2, e)) return; int m = s + e >> 1; if (f(L1, m) >= f(L2, m)) { swap(L1, L2); if (A[nn].l < 0) A[nn].l = ++cnt, A[cnt].L = L1; update(A[nn].l, s, m, L2); } else { if (A[nn].r < 0) A[nn].r = ++cnt, A[cnt].L = L1; update(A[nn].r, m + 1, e, L2); } } void update(ll a, ll b) { update(0, 0, M, pii(a, b)); } ll query(int nn, int s, int e, int x) { if (nn < 0 || s > x || e < x) return 1e18; ll ret = f(A[nn].L, x); int m = s + e >> 1; return min({ret, query(A[nn].l, s, m, x), query(A[nn].r, m + 1, e, x)}); } ll query(int x) { return query(0, 0, M, x); }} cht;ll X, T, W;pii R[200005], P[200005];ll D[200005], H[200005], S[200005];int main() { ios_base::sync_with_stdio(0), cin.tie(0); cin >> X >> N >> M >> W >> T; for (int i = 0; i < N; ++i) { ll x; cin >> x; R[i] = {x % T, x / T}; } for (int i = 1; i <= M; ++i) cin >> P[i].ff >> P[i].ss; R[N] = {X % T, X / T}; sort(R, R + N + 1); sort(P + 1, P + M + 1); for (int i = 1; i <= M; ++i) { S[i] = S[i - 1] + P[i].ss; H[i] = X / T + (X % T >= P[i].ff); } H[0] = X / T + 1; for (int i = M, j = N; i; --i) { while (j >= 0 && R[j].ff > P[i].ff) { cht.update(-W * R[j].ss, D[i + 1] + S[i] + W * i * R[j].ss); --j; } D[i] = min(cht.query(i - 1) - S[i - 1], D[i + 1] + H[i] * W); } cout << D[1] + H[0] * W; return 0;} ^ coach.cpp:1:130: error: stray '\240' in program coach#include <bits/stdc++.h>using namespace std;using ll = long long;using pii = pair<ll, ll>;#define ff first#define ss second int N, M;struct CHT { struct Node { pii L; int l, r; Node() : L(pii(0, 1e18)), l(-1), r(-1) {} } A[5000005]; ll f(pii L, int x) { return L.ff * x + L.ss; } int cnt; void update(int nn, int s, int e, pii L2) { pii &L1 = A[nn].L; if (f(L1, s) > f(L2, s)) swap(L1, L2); if (f(L1, e) <= f(L2, e)) return; int m = s + e >> 1; if (f(L1, m) >= f(L2, m)) { swap(L1, L2); if (A[nn].l < 0) A[nn].l = ++cnt, A[cnt].L = L1; update(A[nn].l, s, m, L2); } else { if (A[nn].r < 0) A[nn].r = ++cnt, A[cnt].L = L1; update(A[nn].r, m + 1, e, L2); } } void update(ll a, ll b) { update(0, 0, M, pii(a, b)); } ll query(int nn, int s, int e, int x) { if (nn < 0 || s > x || e < x) return 1e18; ll ret = f(A[nn].L, x); int m = s + e >> 1; return min({ret, query(A[nn].l, s, m, x), query(A[nn].r, m + 1, e, x)}); } ll query(int x) { return query(0, 0, M, x); }} cht;ll X, T, W;pii R[200005], P[200005];ll D[200005], H[200005], S[200005];int main() { ios_base::sync_with_stdio(0), cin.tie(0); cin >> X >> N >> M >> W >> T; for (int i = 0; i < N; ++i) { ll x; cin >> x; R[i] = {x % T, x / T}; } for (int i = 1; i <= M; ++i) cin >> P[i].ff >> P[i].ss; R[N] = {X % T, X / T}; sort(R, R + N + 1); sort(P + 1, P + M + 1); for (int i = 1; i <= M; ++i) { S[i] = S[i - 1] + P[i].ss; H[i] = X / T + (X % T >= P[i].ff); } H[0] = X / T + 1; for (int i = M, j = N; i; --i) { while (j >= 0 && R[j].ff > P[i].ff) { cht.update(-W * R[j].ss, D[i + 1] + S[i] + W * i * R[j].ss); --j; } D[i] = min(cht.query(i - 1) - S[i - 1], D[i + 1] + H[i] * W); } cout << D[1] + H[0] * W; return 0;} ^ coach.cpp:1:1: error: 'coach' does not name a type coach#include <bits/stdc++.h>using namespace std;using ll = long long;using pii = pair<ll, ll>;#define ff first#define ss second int N, M;struct CHT { struct Node { pii L; int l, r; Node() : L(pii(0, 1e18)), l(-1), r(-1) {} } A[5000005]; ll f(pii L, int x) { return L.ff * x + L.ss; } int cnt; void update(int nn, int s, int e, pii L2) { pii &L1 = A[nn].L; if (f(L1, s) > f(L2, s)) swap(L1, L2); if (f(L1, e) <= f(L2, e)) return; int m = s + e >> 1; if (f(L1, m) >= f(L2, m)) { swap(L1, L2); if (A[nn].l < 0) A[nn].l = ++cnt, A[cnt].L = L1; update(A[nn].l, s, m, L2); } else { if (A[nn].r < 0) A[nn].r = ++cnt, A[cnt].L = L1; update(A[nn].r, m + 1, e, L2); } } void update(ll a, ll b) { update(0, 0, M, pii(a, b)); } ll query(int nn, int s, int e, int x) { if (nn < 0 || s > x || e < x) return 1e18; ll ret = f(A[nn].L, x); int m = s + e >> 1; return min({ret, query(A[nn].l, s, m, x), query(A[nn].r, m + 1, e, x)}); } ll query(int x) { return query(0, 0, M, x); }} cht;ll X, T, W;pii R[200005], P[200005];ll D[200005], H[200005], S[200005];int main() { ios_base::sync_with_stdio(0), cin.tie(0); cin >> X >> N >> M >> W >> T; for (int i = 0; i < N; ++i) { ll x; cin >> x; R[i] = {x % T, x / T}; } for (int i = 1; i <= M; ++i) cin >> P[i].ff >> P[i].ss; R[N] = {X % T, X / T}; sort(R, R + N + 1); sort(P + 1, P + M + 1); for (int i = 1; i <= M; ++i) { S[i] = S[i - 1] + P[i].ss; H[i] = X / T + (X % T >= P[i].ff); } H[0] = X / T + 1; for (int i = M, j = N; i; --i) { while (j >= 0 && R[j].ff > P[i].ff) { cht.update(-W * R[j].ss, D[i + 1] + S[i] + W * i * R[j].ss); --j; } D[i] = min(cht.query(i - 1) - S[i - 1], D[i + 1] + H[i] * W); } cout << D[1] + H[0] * W; return 0;} ^~~~~ coach.cpp:1:83: error: 'pair' does not name a type coach#include <bits/stdc++.h>using namespace std;using ll = long long;using pii = pair<ll, ll>;#define ff first#define ss second int N, M;struct CHT { struct Node { pii L; int l, r; Node() : L(pii(0, 1e18)), l(-1), r(-1) {} } A[5000005]; ll f(pii L, int x) { return L.ff * x + L.ss; } int cnt; void update(int nn, int s, int e, pii L2) { pii &L1 = A[nn].L; if (f(L1, s) > f(L2, s)) swap(L1, L2); if (f(L1, e) <= f(L2, e)) return; int m = s + e >> 1; if (f(L1, m) >= f(L2, m)) { swap(L1, L2); if (A[nn].l < 0) A[nn].l = ++cnt, A[cnt].L = L1; update(A[nn].l, s, m, L2); } else { if (A[nn].r < 0) A[nn].r = ++cnt, A[cnt].L = L1; update(A[nn].r, m + 1, e, L2); } } void update(ll a, ll b) { update(0, 0, M, pii(a, b)); } ll query(int nn, int s, int e, int x) { if (nn < 0 || s > x || e < x) return 1e18; ll ret = f(A[nn].L, x); int m = s + e >> 1; return min({ret, query(A[nn].l, s, m, x), query(A[nn].r, m + 1, e, x)}); } ll query(int x) { return query(0, 0, M, x); }} cht;ll X, T, W;pii R[200005], P[200005];ll D[200005], H[200005], S[200005];int main() { ios_base::sync_with_stdio(0), cin.tie(0); cin >> X >> N >> M >> W >> T; for (int i = 0; i < N; ++i) { ll x; cin >> x; R[i] = {x % T, x / T}; } for (int i = 1; i <= M; ++i) cin >> P[i].ff >> P[i].ss; R[N] = {X % T, X / T}; sort(R, R + N + 1); sort(P + 1, P + M + 1); for (int i = 1; i <= M; ++i) { S[i] = S[i - 1] + P[i].ss; H[i] = X / T + (X % T >= P[i].ff); } H[0] = X / T + 1; for (int i = M, j = N; i; --i) { while (j >= 0 && R[j].ff > P[i].ff) { cht.update(-W * R[j].ss, D[i + 1] + S[i] + W * i * R[j].ss); --j; } D[i] = min(cht.query(i - 1) - S[i - 1], D[i + 1] + H[i] * W); } cout << D[1] + H[0] * W; return 0;} ^~~~ coach.cpp:1:97: error: 'define' does not name a type coach#include <bits/stdc++.h>using namespace std;using ll = long long;using pii = pair<ll, ll>;#define ff first#define ss second int N, M;struct CHT { struct Node { pii L; int l, r; Node() : L(pii(0, 1e18)), l(-1), r(-1) {} } A[5000005]; ll f(pii L, int x) { return L.ff * x + L.ss; } int cnt; void update(int nn, int s, int e, pii L2) { pii &L1 = A[nn].L; if (f(L1, s) > f(L2, s)) swap(L1, L2); if (f(L1, e) <= f(L2, e)) return; int m = s + e >> 1; if (f(L1, m) >= f(L2, m)) { swap(L1, L2); if (A[nn].l < 0) A[nn].l = ++cnt, A[cnt].L = L1; update(A[nn].l, s, m, L2); } else { if (A[nn].r < 0) A[nn].r = ++cnt, A[cnt].L = L1; update(A[nn].r, m + 1, e, L2); } } void update(ll a, ll b) { update(0, 0, M, pii(a, b)); } ll query(int nn, int s, int e, int x) { if (nn < 0 || s > x || e < x) return 1e18; ll ret = f(A[nn].L, x); int m = s + e >> 1; return min({ret, query(A[nn].l, s, m, x), query(A[nn].r, m + 1, e, x)}); } ll query(int x) { return query(0, 0, M, x); }} cht;ll X, T, W;pii R[200005], P[200005];ll D[200005], H[200005], S[200005];int main() { ios_base::sync_with_stdio(0), cin.tie(0); cin >> X >> N >> M >> W >> T; for (int i = 0; i < N; ++i) { ll x; cin >> x; R[i] = {x % T, x / T}; } for (int i = 1; i <= M; ++i) cin >> P[i].ff >> P[i].ss; R[N] = {X % T, X / T}; sort(R, R + N + 1); sort(P + 1, P + M + 1); for (int i = 1; i <= M; ++i) { S[i] = S[i - 1] + P[i].ss; H[i] = X / T + (X % T >= P[i].ff); } H[0] = X / T + 1; for (int i = M, j = N; i; --i) { while (j >= 0 && R[j].ff > P[i].ff) { cht.update(-W * R[j].ss, D[i + 1] + S[i] + W * i * R[j].ss); --j; } D[i] = min(cht.query(i - 1) - S[i - 1], D[i + 1] + H[i] * W); } cout << D[1] + H[0] * W; return 0;} ^~~~~~ coach.cpp:1:168: error: 'pii' does not name a type coach#include <bits/stdc++.h>using namespace std;using ll = long long;using pii = pair<ll, ll>;#define ff first#define ss second int N, M;struct CHT { struct Node { pii L; int l, r; Node() : L(pii(0, 1e18)), l(-1), r(-1) {} } A[5000005]; ll f(pii L, int x) { return L.ff * x + L.ss; } int cnt; void update(int nn, int s, int e, pii L2) { pii &L1 = A[nn].L; if (f(L1, s) > f(L2, s)) swap(L1, L2); if (f(L1, e) <= f(L2, e)) return; int m = s + e >> 1; if (f(L1, m) >= f(L2, m)) { swap(L1, L2); if (A[nn].l < 0) A[nn].l = ++cnt, A[cnt].L = L1; update(A[nn].l, s, m, L2); } else { if (A[nn].r < 0) A[nn].r = ++cnt, A[cnt].L = L1; update(A[nn].r, m + 1, e, L2); } } void update(ll a, ll b) { update(0, 0, M, pii(a, b)); } ll query(int nn, int s, int e, int x) { if (nn < 0 || s > x || e < x) return 1e18; ll ret = f(A[nn].L, x); int m = s + e >> 1; return min({ret, query(A[nn].l, s, m, x), query(A[nn].r, m + 1, e, x)}); } ll query(int x) { return query(0, 0, M, x); }} cht;ll X, T, W;pii R[200005], P[200005];ll D[200005], H[200005], S[200005];int main() { ios_base::sync_with_stdio(0), cin.tie(0); cin >> X >> N >> M >> W >> T; for (int i = 0; i < N; ++i) { ll x; cin >> x; R[i] = {x % T, x / T}; } for (int i = 1; i <= M; ++i) cin >> P[i].ff >> P[i].ss; R[N] = {X % T, X / T}; sort(R, R + N + 1); sort(P + 1, P + M + 1); for (int i = 1; i <= M; ++i) { S[i] = S[i - 1] + P[i].ss; H[i] = X / T + (X % T >= P[i].ff); } H[0] = X / T + 1; for (int i = M, j = N; i; --i) { while (j >= 0 && R[j].ff > P[i].ff) { cht.update(-W * R[j].ss, D[i + 1] + S[i] + W * i * R[j].ss); --j; } D[i] = min(cht.query(i - 1) - S[i - 1], D[i + 1] + H[i] * W); } cout << D[1] + H[0] * W; return 0;} ^~~ coach.cpp:1:248: error: 'pii' has not been declared coach#include <bits/stdc++.h>using namespace std;using ll = long long;using pii = pair<ll, ll>;#define ff first#define ss second int N, M;struct CHT { struct Node { pii L; int l, r; Node() : L(pii(0, 1e18)), l(-1), r(-1) {} } A[5000005]; ll f(pii L, int x) { return L.ff * x + L.ss; } int cnt; void update(int nn, int s, int e, pii L2) { pii &L1 = A[nn].L; if (f(L1, s) > f(L2, s)) swap(L1, L2); if (f(L1, e) <= f(L2, e)) return; int m = s + e >> 1; if (f(L1, m) >= f(L2, m)) { swap(L1, L2); if (A[nn].l < 0) A[nn].l = ++cnt, A[cnt].L = L1; update(A[nn].l, s, m, L2); } else { if (A[nn].r < 0) A[nn].r = ++cnt, A[cnt].L = L1; update(A[nn].r, m + 1, e, L2); } } void update(ll a, ll b) { update(0, 0, M, pii(a, b)); } ll query(int nn, int s, int e, int x) { if (nn < 0 || s > x || e < x) return 1e18; ll ret = f(A[nn].L, x); int m = s + e >> 1; return min({ret, query(A[nn].l, s, m, x), query(A[nn].r, m + 1, e, x)}); } ll query(int x) { return query(0, 0, M, x); }} cht;ll X, T, W;pii R[200005], P[200005];ll D[200005], H[200005], S[200005];int main() { ios_base::sync_with_stdio(0), cin.tie(0); cin >> X >> N >> M >> W >> T; for (int i = 0; i < N; ++i) { ll x; cin >> x; R[i] = {x % T, x / T}; } for (int i = 1; i <= M; ++i) cin >> P[i].ff >> P[i].ss; R[N] = {X % T, X / T}; sort(R, R + N + 1); sort(P + 1, P + M + 1); for (int i = 1; i <= M; ++i) { S[i] = S[i - 1] + P[i].ss; H[i] = X / T + (X % T >= P[i].ff); } H[0] = X / T + 1; for (int i = M, j = N; i; --i) { while (j >= 0 && R[j].ff > P[i].ff) { cht.update(-W * R[j].ss, D[i + 1] + S[i] + W * i * R[j].ss); --j; } D[i] = min(cht.query(i - 1) - S[i - 1], D[i + 1] + H[i] * W); } cout << D[1] + H[0] * W; return 0;} ^~~ coach.cpp:1:333: error: 'pii' has not been declared coach#include <bits/stdc++.h>using namespace std;using ll = long long;using pii = pair<ll, ll>;#define ff first#define ss second int N, M;struct CHT { struct Node { pii L; int l, r; Node() : L(pii(0, 1e18)), l(-1), r(-1) {} } A[5000005]; ll f(pii L, int x) { return L.ff * x + L.ss; } int cnt; void update(int nn, int s, int e, pii L2) { pii &L1 = A[nn].L; if (f(L1, s) > f(L2, s)) swap(L1, L2); if (f(L1, e) <= f(L2, e)) return; int m = s + e >> 1; if (f(L1, m) >= f(L2, m)) { swap(L1, L2); if (A[nn].l < 0) A[nn].l = ++cnt, A[cnt].L = L1; update(A[nn].l, s, m, L2); } else { if (A[nn].r < 0) A[nn].r = ++cnt, A[cnt].L = L1; update(A[nn].r, m + 1, e, L2); } } void update(ll a, ll b) { update(0, 0, M, pii(a, b)); } ll query(int nn, int s, int e, int x) { if (nn < 0 || s > x || e < x) return 1e18; ll ret = f(A[nn].L, x); int m = s + e >> 1; return min({ret, query(A[nn].l, s, m, x), query(A[nn].r, m + 1, e, x)}); } ll