#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint INF = 1e16;
class SegmentTree {
private:
// We keep dp[n] = tree[n] + transition[n], to be able to do updates quickly
int sz;
vector<lint> tree;
vector<lint> lazy_sum;
vector<lint> lazy_max;
vector<lint> transition;
void Push(int n) {
for (int c = 0; c < 2; c++) {
tree[n * 2 + c] += lazy_sum[n];
lazy_sum[n * 2 + c] += lazy_sum[n];
lazy_max[n * 2 + c] += lazy_sum[n];
tree[n * 2 + c] = max(tree[n * 2 + c], lazy_max[n]);
lazy_max[n * 2 + c] = max(lazy_max[n * 2 + c], lazy_max[n]);
transition[n * 2 + c] += transition[n];
}
lazy_max[n] = -INF;
lazy_sum[n] = 0;
transition[n] = 0;
}
void RangeSumUpdate(int n, int tl, int tr, int l, int r, lint x, bool update_tree) {
if (r < tl || tr < l || tl > tr || l > r) return;
if (l <= tl && tr <= r) {
if (update_tree) {
tree[n] += x;
lazy_sum[n] += x;
lazy_max[n] += x;
} else {
transition[n] += x;
}
return;
}
Push(n);
int mid = (tl + tr) / 2;
RangeSumUpdate(n * 2, tl, mid, l, r, x, update_tree);
RangeSumUpdate(n * 2 + 1, mid + 1, tr, l, r, x, update_tree);
}
void RangeMaximumUpdate(int n, int tl, int tr, int l, int r, lint x) {
if (r < tl || tr < l || tl > tr || l > r) return;
if (l <= tl && tr <= r) {
tree[n] = max(tree[n], x);
lazy_max[n] = max(lazy_max[n], x);
return;
}
Push(n);
int mid = (tl + tr) / 2;
RangeMaximumUpdate(n * 2, tl, mid, l, r, x);
RangeMaximumUpdate(n * 2 + 1, mid + 1, tr, l, r, x);
}
lint QueryTree(int n, int tl, int tr, int pos) {
if (tl == tr) return tree[n]; // dp[] = tree[] + transition[]
Push(n);
int mid = (tl + tr) / 2;
if (pos <= mid) {
return QueryTree(n * 2, tl, mid, pos);
} else {
return QueryTree(n * 2 + 1, mid + 1, tr, pos);
}
}
lint Query(int n, int tl, int tr, int pos) {
if (tl == tr) return tree[n] + transition[n]; // dp[] = tree[] + transition[]
Push(n);
int mid = (tl + tr) / 2;
if (pos <= mid) {
return Query(n * 2, tl, mid, pos);
} else {
return Query(n * 2 + 1, mid + 1, tr, pos);
}
}
public:
SegmentTree(int n) : sz(n) {
tree.assign(4 * sz, 0);
lazy_sum.assign(4 * sz, 0);
lazy_max.assign(4 * sz, -INF);
transition.assign(4 * sz, 0);
}
void UpdateSumTree(int l, int r, lint x) { // range sum update on dp
return RangeSumUpdate(1, 0, sz - 1, l, r, x, true);
}
void UpdateTransition(int l, int r, lint x) { // range sum update on transition
return RangeSumUpdate(1, 0, sz - 1, l, r, x, false);
}
void UpdateMaximumTree(int l, int r, lint x) { // dp[k] = max(dp[k], transition[k] + x), x = dp[0], for all nodes
return RangeMaximumUpdate(1, 0, sz - 1, l, r, x);
}
lint QueryTree(int pos) {
return QueryTree(1, 0, sz - 1, pos);
}
lint Query(int pos) {
return Query(1, 0, sz - 1, pos);
}
};
int N, M;
vector<int> X; // X[i] = maximum index j, such that A[1] + A[2] + ... + A[i] + B[1] + B[2] + ... + B[j] <= S[i]
vector<int> Y; // Y[j] = maximum index i, such that A[1] + A[2] + ... + A[i] + B[1] + B[2] + ... + B[j] <= T[j]
vector<int> P; // We get P[i] points if current j <= X[i]
vector<int> Q; // We get Q[j] points if current i <= Y[j]
lint NaiveDP(bool dbg = false) {
vector<vector<lint>> dp(N + 1, vector<lint>(M + 1, -INF));
dp[0][0] = 0;
for (int i = 0; i <= N; i++) {
for (int j = 0; j <= M; j++) {
if (j < M) dp[i][j + 1] = max(dp[i][j + 1], dp[i][j] + (i <= Y[j + 1] ? Q[j + 1] : 0));
if (i < N) dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + (j <= X[i + 1] ? P[i + 1] : 0));
}
}
if (dbg) {
for (int i = 0; i <= N; i++) {
for (int j = 0; j <= M; j++) {
cout << dp[i][j] << " \n"[j == M];
}
}
}
return dp[N][M];
}
lint SegmentTreeDP() {
SegmentTree seg(M + 1);
vector<vector<int>> deactivate(N + 1); // deactivate Q[j] at row i
for (int j = 1; j <= M; j++) {
if (0 <= Y[j]) {
seg.UpdateTransition(j, M, Q[j]);
deactivate[Y[j]].emplace_back(j);
}
}
for (int i = 0; i < N; i++) {
sort(begin(deactivate[i]), end(deactivate[i]));
for (auto j : deactivate[i]) {
seg.UpdateTransition(j, M, -Q[j]);
seg.UpdateSumTree(j, M, Q[j]);
}
seg.UpdateSumTree(0, X[i + 1], P[i + 1]);
seg.UpdateMaximumTree(X[i + 1] + 1, M, seg.QueryTree(X[i + 1])); // maintain monotonicity
for (auto j : deactivate[i]) {
// make tree[] monotone again, by range maximum update on tree.
// This simulates the transition dp[i][j + 1] from dp[i][j]
// As only the values [j + 1, M] changes, we only need to compare
// it with the value at [j]. This is done AFTER we have changed rows,
// so there exists a path without going through points Q[]. This
// is important in case when Q[j] < 0, since we want to avoid it.
seg.UpdateMaximumTree(j, M, seg.QueryTree(j - 1));
}
}
return seg.Query(M);
}
void Read() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
cin >> N >> M;
vector<lint> A(N + 1), B(M + 1);
vector<lint> S(N + 1), T(M + 1);
P.resize(N + 1), Q.resize(M + 1);
X.resize(N + 1), Y.resize(M + 1);
for (int i = 1; i <= N; i++) {
cin >> A[i] >> S[i] >> P[i];
A[i] += A[i - 1];
}
for (int i = 1; i <= M; i++) {
cin >> B[i] >> T[i] >> Q[i];
B[i] += B[i - 1];
}
for (int i = 0; i <= N; i++) {
X[i] = upper_bound(begin(B), end(B), S[i] - A[i]) - begin(B) - 1;
}
for (int i = 0; i <= M; i++) {
Y[i] = upper_bound(begin(A), end(A), T[i] - B[i]) - begin(A) - 1;
}
}
int main() {
Read();
cout << SegmentTreeDP() << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
958 ms |
38944 KB |
Output is correct |
2 |
Correct |
934 ms |
47716 KB |
Output is correct |
3 |
Correct |
665 ms |
45568 KB |
Output is correct |
4 |
Correct |
841 ms |
47684 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
917 ms |
45316 KB |
Output is correct |
7 |
Correct |
200 ms |
32700 KB |
Output is correct |
8 |
Correct |
103 ms |
10816 KB |
Output is correct |
9 |
Correct |
777 ms |
46204 KB |
Output is correct |
10 |
Correct |
947 ms |
44156 KB |
Output is correct |
11 |
Correct |
628 ms |
40060 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
6 |
Correct |
4 ms |
384 KB |
Output is correct |
7 |
Correct |
4 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
384 KB |
Output is correct |
11 |
Correct |
4 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
4 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
4 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
6 |
Correct |
4 ms |
384 KB |
Output is correct |
7 |
Correct |
4 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
384 KB |
Output is correct |
11 |
Correct |
4 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
4 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
4 ms |
384 KB |
Output is correct |
17 |
Correct |
7 ms |
640 KB |
Output is correct |
18 |
Correct |
8 ms |
640 KB |
Output is correct |
19 |
Correct |
10 ms |
640 KB |
Output is correct |
20 |
Correct |
8 ms |
640 KB |
Output is correct |
21 |
Correct |
10 ms |
692 KB |
Output is correct |
22 |
Correct |
10 ms |
640 KB |
Output is correct |
23 |
Correct |
9 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
6 |
Correct |
4 ms |
384 KB |
Output is correct |
7 |
Correct |
4 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
384 KB |
Output is correct |
11 |
Correct |
4 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
4 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
4 ms |
384 KB |
Output is correct |
17 |
Correct |
7 ms |
640 KB |
Output is correct |
18 |
Correct |
8 ms |
640 KB |
Output is correct |
19 |
Correct |
10 ms |
640 KB |
Output is correct |
20 |
Correct |
8 ms |
640 KB |
Output is correct |
21 |
Correct |
10 ms |
692 KB |
Output is correct |
22 |
Correct |
10 ms |
640 KB |
Output is correct |
23 |
Correct |
9 ms |
640 KB |
Output is correct |
24 |
Correct |
1253 ms |
41992 KB |
Output is correct |
25 |
Correct |
1062 ms |
42876 KB |
Output is correct |
26 |
Correct |
539 ms |
42108 KB |
Output is correct |
27 |
Correct |
1076 ms |
47484 KB |
Output is correct |
28 |
Correct |
802 ms |
43132 KB |
Output is correct |
29 |
Correct |
647 ms |
43644 KB |
Output is correct |
30 |
Correct |
1213 ms |
45056 KB |
Output is correct |
31 |
Correct |
393 ms |
30776 KB |
Output is correct |
32 |
Correct |
93 ms |
9028 KB |
Output is correct |
33 |
Correct |
882 ms |
43068 KB |
Output is correct |
34 |
Correct |
1094 ms |
42500 KB |
Output is correct |
35 |
Correct |
1125 ms |
38656 KB |
Output is correct |
36 |
Correct |
1140 ms |
38524 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
6 |
Correct |
4 ms |
384 KB |
Output is correct |
7 |
Correct |
4 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
384 KB |
Output is correct |
11 |
Correct |
4 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
4 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
4 ms |
384 KB |
Output is correct |
17 |
Correct |
7 ms |
640 KB |
Output is correct |
18 |
Correct |
8 ms |
640 KB |
Output is correct |
19 |
Correct |
10 ms |
640 KB |
Output is correct |
20 |
Correct |
8 ms |
640 KB |
Output is correct |
21 |
Correct |
10 ms |
692 KB |
Output is correct |
22 |
Correct |
10 ms |
640 KB |
Output is correct |
23 |
Correct |
9 ms |
640 KB |
Output is correct |
24 |
Correct |
1253 ms |
41992 KB |
Output is correct |
25 |
Correct |
1062 ms |
42876 KB |
Output is correct |
26 |
Correct |
539 ms |
42108 KB |
Output is correct |
27 |
Correct |
1076 ms |
47484 KB |
Output is correct |
28 |
Correct |
802 ms |
43132 KB |
Output is correct |
29 |
Correct |
647 ms |
43644 KB |
Output is correct |
30 |
Correct |
1213 ms |
45056 KB |
Output is correct |
31 |
Correct |
393 ms |
30776 KB |
Output is correct |
32 |
Correct |
93 ms |
9028 KB |
Output is correct |
33 |
Correct |
882 ms |
43068 KB |
Output is correct |
34 |
Correct |
1094 ms |
42500 KB |
Output is correct |
35 |
Correct |
1125 ms |
38656 KB |
Output is correct |
36 |
Correct |
1140 ms |
38524 KB |
Output is correct |
37 |
Correct |
572 ms |
45052 KB |
Output is correct |
38 |
Correct |
1104 ms |
50380 KB |
Output is correct |
39 |
Correct |
946 ms |
47804 KB |
Output is correct |
40 |
Correct |
956 ms |
47860 KB |
Output is correct |
41 |
Correct |
5 ms |
384 KB |
Output is correct |
42 |
Correct |
1254 ms |
48148 KB |
Output is correct |
43 |
Correct |
915 ms |
46044 KB |
Output is correct |
44 |
Correct |
1063 ms |
45296 KB |
Output is correct |
45 |
Correct |
1193 ms |
41664 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
6 |
Correct |
4 ms |
384 KB |
Output is correct |
7 |
Correct |
4 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
384 KB |
Output is correct |
11 |
Correct |
4 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
4 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
4 ms |
384 KB |
Output is correct |
17 |
Correct |
7 ms |
640 KB |
Output is correct |
18 |
Correct |
8 ms |
640 KB |
Output is correct |
19 |
Correct |
10 ms |
640 KB |
Output is correct |
20 |
Correct |
8 ms |
640 KB |
Output is correct |
21 |
Correct |
10 ms |
692 KB |
Output is correct |
22 |
Correct |
10 ms |
640 KB |
Output is correct |
23 |
Correct |
9 ms |
640 KB |
Output is correct |
24 |
Correct |
1253 ms |
41992 KB |
Output is correct |
25 |
Correct |
1062 ms |
42876 KB |
Output is correct |
26 |
Correct |
539 ms |
42108 KB |
Output is correct |
27 |
Correct |
1076 ms |
47484 KB |
Output is correct |
28 |
Correct |
802 ms |
43132 KB |
Output is correct |
29 |
Correct |
647 ms |
43644 KB |
Output is correct |
30 |
Correct |
1213 ms |
45056 KB |
Output is correct |
31 |
Correct |
393 ms |
30776 KB |
Output is correct |
32 |
Correct |
93 ms |
9028 KB |
Output is correct |
33 |
Correct |
882 ms |
43068 KB |
Output is correct |
34 |
Correct |
1094 ms |
42500 KB |
Output is correct |
35 |
Correct |
1125 ms |
38656 KB |
Output is correct |
36 |
Correct |
1140 ms |
38524 KB |
Output is correct |
37 |
Correct |
572 ms |
45052 KB |
Output is correct |
38 |
Correct |
1104 ms |
50380 KB |
Output is correct |
39 |
Correct |
946 ms |
47804 KB |
Output is correct |
40 |
Correct |
956 ms |
47860 KB |
Output is correct |
41 |
Correct |
5 ms |
384 KB |
Output is correct |
42 |
Correct |
1254 ms |
48148 KB |
Output is correct |
43 |
Correct |
915 ms |
46044 KB |
Output is correct |
44 |
Correct |
1063 ms |
45296 KB |
Output is correct |
45 |
Correct |
1193 ms |
41664 KB |
Output is correct |
46 |
Correct |
3057 ms |
170652 KB |
Output is correct |
47 |
Correct |
6165 ms |
198060 KB |
Output is correct |
48 |
Correct |
5466 ms |
197636 KB |
Output is correct |
49 |
Correct |
5464 ms |
197664 KB |
Output is correct |
50 |
Correct |
7695 ms |
186520 KB |
Output is correct |
51 |
Correct |
5216 ms |
176284 KB |
Output is correct |
52 |
Correct |
6336 ms |
163760 KB |
Output is correct |
53 |
Correct |
7243 ms |
185144 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
958 ms |
38944 KB |
Output is correct |
2 |
Correct |
934 ms |
47716 KB |
Output is correct |
3 |
Correct |
665 ms |
45568 KB |
Output is correct |
4 |
Correct |
841 ms |
47684 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
917 ms |
45316 KB |
Output is correct |
7 |
Correct |
200 ms |
32700 KB |
Output is correct |
8 |
Correct |
103 ms |
10816 KB |
Output is correct |
9 |
Correct |
777 ms |
46204 KB |
Output is correct |
10 |
Correct |
947 ms |
44156 KB |
Output is correct |
11 |
Correct |
628 ms |
40060 KB |
Output is correct |
12 |
Correct |
4 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
384 KB |
Output is correct |
15 |
Correct |
4 ms |
384 KB |
Output is correct |
16 |
Correct |
4 ms |
384 KB |
Output is correct |
17 |
Correct |
4 ms |
384 KB |
Output is correct |
18 |
Correct |
4 ms |
384 KB |
Output is correct |
19 |
Correct |
5 ms |
384 KB |
Output is correct |
20 |
Correct |
4 ms |
384 KB |
Output is correct |
21 |
Correct |
4 ms |
384 KB |
Output is correct |
22 |
Correct |
4 ms |
384 KB |
Output is correct |
23 |
Correct |
5 ms |
384 KB |
Output is correct |
24 |
Correct |
4 ms |
384 KB |
Output is correct |
25 |
Correct |
4 ms |
384 KB |
Output is correct |
26 |
Correct |
5 ms |
384 KB |
Output is correct |
27 |
Correct |
4 ms |
384 KB |
Output is correct |
28 |
Correct |
7 ms |
640 KB |
Output is correct |
29 |
Correct |
8 ms |
640 KB |
Output is correct |
30 |
Correct |
10 ms |
640 KB |
Output is correct |
31 |
Correct |
8 ms |
640 KB |
Output is correct |
32 |
Correct |
10 ms |
692 KB |
Output is correct |
33 |
Correct |
10 ms |
640 KB |
Output is correct |
34 |
Correct |
9 ms |
640 KB |
Output is correct |
35 |
Correct |
1253 ms |
41992 KB |
Output is correct |
36 |
Correct |
1062 ms |
42876 KB |
Output is correct |
37 |
Correct |
539 ms |
42108 KB |
Output is correct |
38 |
Correct |
1076 ms |
47484 KB |
Output is correct |
39 |
Correct |
802 ms |
43132 KB |
Output is correct |
40 |
Correct |
647 ms |
43644 KB |
Output is correct |
41 |
Correct |
1213 ms |
45056 KB |
Output is correct |
42 |
Correct |
393 ms |
30776 KB |
Output is correct |
43 |
Correct |
93 ms |
9028 KB |
Output is correct |
44 |
Correct |
882 ms |
43068 KB |
Output is correct |
45 |
Correct |
1094 ms |
42500 KB |
Output is correct |
46 |
Correct |
1125 ms |
38656 KB |
Output is correct |
47 |
Correct |
1140 ms |
38524 KB |
Output is correct |
48 |
Correct |
572 ms |
45052 KB |
Output is correct |
49 |
Correct |
1104 ms |
50380 KB |
Output is correct |
50 |
Correct |
946 ms |
47804 KB |
Output is correct |
51 |
Correct |
956 ms |
47860 KB |
Output is correct |
52 |
Correct |
5 ms |
384 KB |
Output is correct |
53 |
Correct |
1254 ms |
48148 KB |
Output is correct |
54 |
Correct |
915 ms |
46044 KB |
Output is correct |
55 |
Correct |
1063 ms |
45296 KB |
Output is correct |
56 |
Correct |
1193 ms |
41664 KB |
Output is correct |
57 |
Correct |
561 ms |
48252 KB |
Output is correct |
58 |
Correct |
1119 ms |
53828 KB |
Output is correct |
59 |
Correct |
968 ms |
51580 KB |
Output is correct |
60 |
Correct |
979 ms |
51580 KB |
Output is correct |
61 |
Correct |
1224 ms |
47996 KB |
Output is correct |
62 |
Correct |
5 ms |
384 KB |
Output is correct |
63 |
Correct |
1229 ms |
51100 KB |
Output is correct |
64 |
Correct |
933 ms |
48116 KB |
Output is correct |
65 |
Correct |
1087 ms |
49060 KB |
Output is correct |
66 |
Correct |
1164 ms |
44796 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
958 ms |
38944 KB |
Output is correct |
2 |
Correct |
934 ms |
47716 KB |
Output is correct |
3 |
Correct |
665 ms |
45568 KB |
Output is correct |
4 |
Correct |
841 ms |
47684 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
917 ms |
45316 KB |
Output is correct |
7 |
Correct |
200 ms |
32700 KB |
Output is correct |
8 |
Correct |
103 ms |
10816 KB |
Output is correct |
9 |
Correct |
777 ms |
46204 KB |
Output is correct |
10 |
Correct |
947 ms |
44156 KB |
Output is correct |
11 |
Correct |
628 ms |
40060 KB |
Output is correct |
12 |
Correct |
4 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
384 KB |
Output is correct |
15 |
Correct |
4 ms |
384 KB |
Output is correct |
16 |
Correct |
4 ms |
384 KB |
Output is correct |
17 |
Correct |
4 ms |
384 KB |
Output is correct |
18 |
Correct |
4 ms |
384 KB |
Output is correct |
19 |
Correct |
5 ms |
384 KB |
Output is correct |
20 |
Correct |
4 ms |
384 KB |
Output is correct |
21 |
Correct |
4 ms |
384 KB |
Output is correct |
22 |
Correct |
4 ms |
384 KB |
Output is correct |
23 |
Correct |
5 ms |
384 KB |
Output is correct |
24 |
Correct |
4 ms |
384 KB |
Output is correct |
25 |
Correct |
4 ms |
384 KB |
Output is correct |
26 |
Correct |
5 ms |
384 KB |
Output is correct |
27 |
Correct |
4 ms |
384 KB |
Output is correct |
28 |
Correct |
7 ms |
640 KB |
Output is correct |
29 |
Correct |
8 ms |
640 KB |
Output is correct |
30 |
Correct |
10 ms |
640 KB |
Output is correct |
31 |
Correct |
8 ms |
640 KB |
Output is correct |
32 |
Correct |
10 ms |
692 KB |
Output is correct |
33 |
Correct |
10 ms |
640 KB |
Output is correct |
34 |
Correct |
9 ms |
640 KB |
Output is correct |
35 |
Correct |
1253 ms |
41992 KB |
Output is correct |
36 |
Correct |
1062 ms |
42876 KB |
Output is correct |
37 |
Correct |
539 ms |
42108 KB |
Output is correct |
38 |
Correct |
1076 ms |
47484 KB |
Output is correct |
39 |
Correct |
802 ms |
43132 KB |
Output is correct |
40 |
Correct |
647 ms |
43644 KB |
Output is correct |
41 |
Correct |
1213 ms |
45056 KB |
Output is correct |
42 |
Correct |
393 ms |
30776 KB |
Output is correct |
43 |
Correct |
93 ms |
9028 KB |
Output is correct |
44 |
Correct |
882 ms |
43068 KB |
Output is correct |
45 |
Correct |
1094 ms |
42500 KB |
Output is correct |
46 |
Correct |
1125 ms |
38656 KB |
Output is correct |
47 |
Correct |
1140 ms |
38524 KB |
Output is correct |
48 |
Correct |
572 ms |
45052 KB |
Output is correct |
49 |
Correct |
1104 ms |
50380 KB |
Output is correct |
50 |
Correct |
946 ms |
47804 KB |
Output is correct |
51 |
Correct |
956 ms |
47860 KB |
Output is correct |
52 |
Correct |
5 ms |
384 KB |
Output is correct |
53 |
Correct |
1254 ms |
48148 KB |
Output is correct |
54 |
Correct |
915 ms |
46044 KB |
Output is correct |
55 |
Correct |
1063 ms |
45296 KB |
Output is correct |
56 |
Correct |
1193 ms |
41664 KB |
Output is correct |
57 |
Correct |
3057 ms |
170652 KB |
Output is correct |
58 |
Correct |
6165 ms |
198060 KB |
Output is correct |
59 |
Correct |
5466 ms |
197636 KB |
Output is correct |
60 |
Correct |
5464 ms |
197664 KB |
Output is correct |
61 |
Correct |
7695 ms |
186520 KB |
Output is correct |
62 |
Correct |
5216 ms |
176284 KB |
Output is correct |
63 |
Correct |
6336 ms |
163760 KB |
Output is correct |
64 |
Correct |
7243 ms |
185144 KB |
Output is correct |
65 |
Correct |
561 ms |
48252 KB |
Output is correct |
66 |
Correct |
1119 ms |
53828 KB |
Output is correct |
67 |
Correct |
968 ms |
51580 KB |
Output is correct |
68 |
Correct |
979 ms |
51580 KB |
Output is correct |
69 |
Correct |
1224 ms |
47996 KB |
Output is correct |
70 |
Correct |
5 ms |
384 KB |
Output is correct |
71 |
Correct |
1229 ms |
51100 KB |
Output is correct |
72 |
Correct |
933 ms |
48116 KB |
Output is correct |
73 |
Correct |
1087 ms |
49060 KB |
Output is correct |
74 |
Correct |
1164 ms |
44796 KB |
Output is correct |
75 |
Correct |
3048 ms |
170960 KB |
Output is correct |
76 |
Correct |
6137 ms |
197932 KB |
Output is correct |
77 |
Correct |
5393 ms |
197444 KB |
Output is correct |
78 |
Correct |
5371 ms |
197340 KB |
Output is correct |
79 |
Correct |
7789 ms |
186136 KB |
Output is correct |
80 |
Correct |
5274 ms |
169208 KB |
Output is correct |
81 |
Correct |
5922 ms |
174136 KB |
Output is correct |
82 |
Correct |
7514 ms |
185012 KB |
Output is correct |
83 |
Correct |
7308 ms |
184476 KB |
Output is correct |