Submission #218921

# Submission time Handle Problem Language Result Execution time Memory
218921 2020-04-03T07:28:01 Z rama_pang Two Dishes (JOI19_dishes) C++14
100 / 100
7792 ms 268060 KB
#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;
vector<int> Q;

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].
      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 994 ms 36988 KB Output is correct
2 Correct 932 ms 36836 KB Output is correct
3 Correct 671 ms 35068 KB Output is correct
4 Correct 817 ms 36708 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 885 ms 34820 KB Output is correct
7 Correct 195 ms 28728 KB Output is correct
8 Correct 100 ms 6592 KB Output is correct
9 Correct 679 ms 35068 KB Output is correct
10 Correct 937 ms 39548 KB Output is correct
11 Correct 635 ms 35060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 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 4 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 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 4 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 7 ms 640 KB Output is correct
18 Correct 9 ms 640 KB Output is correct
19 Correct 10 ms 640 KB Output is correct
20 Correct 9 ms 640 KB Output is correct
21 Correct 9 ms 640 KB Output is correct
22 Correct 9 ms 640 KB Output is correct
23 Correct 10 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 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 4 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 7 ms 640 KB Output is correct
18 Correct 9 ms 640 KB Output is correct
19 Correct 10 ms 640 KB Output is correct
20 Correct 9 ms 640 KB Output is correct
21 Correct 9 ms 640 KB Output is correct
22 Correct 9 ms 640 KB Output is correct
23 Correct 10 ms 640 KB Output is correct
24 Correct 1247 ms 34300 KB Output is correct
25 Correct 1047 ms 35068 KB Output is correct
26 Correct 504 ms 34176 KB Output is correct
27 Correct 1069 ms 39548 KB Output is correct
28 Correct 796 ms 35068 KB Output is correct
29 Correct 649 ms 35068 KB Output is correct
30 Correct 1178 ms 37116 KB Output is correct
31 Correct 390 ms 28348 KB Output is correct
32 Correct 91 ms 6592 KB Output is correct
33 Correct 883 ms 35524 KB Output is correct
34 Correct 1060 ms 34692 KB Output is correct
35 Correct 1115 ms 37244 KB Output is correct
36 Correct 1159 ms 37244 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 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 4 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 7 ms 640 KB Output is correct
18 Correct 9 ms 640 KB Output is correct
19 Correct 10 ms 640 KB Output is correct
20 Correct 9 ms 640 KB Output is correct
21 Correct 9 ms 640 KB Output is correct
22 Correct 9 ms 640 KB Output is correct
23 Correct 10 ms 640 KB Output is correct
24 Correct 1247 ms 34300 KB Output is correct
25 Correct 1047 ms 35068 KB Output is correct
26 Correct 504 ms 34176 KB Output is correct
27 Correct 1069 ms 39548 KB Output is correct
28 Correct 796 ms 35068 KB Output is correct
29 Correct 649 ms 35068 KB Output is correct
30 Correct 1178 ms 37116 KB Output is correct
31 Correct 390 ms 28348 KB Output is correct
32 Correct 91 ms 6592 KB Output is correct
33 Correct 883 ms 35524 KB Output is correct
34 Correct 1060 ms 34692 KB Output is correct
35 Correct 1115 ms 37244 KB Output is correct
36 Correct 1159 ms 37244 KB Output is correct
37 Correct 556 ms 34148 KB Output is correct
38 Correct 1093 ms 39636 KB Output is correct
39 Correct 975 ms 39560 KB Output is correct
40 Correct 981 ms 39680 KB Output is correct
41 Correct 4 ms 384 KB Output is correct
42 Correct 1239 ms 37244 KB Output is correct
43 Correct 903 ms 35548 KB Output is correct
44 Correct 1094 ms 34588 KB Output is correct
45 Correct 1182 ms 37244 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 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 4 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 7 ms 640 KB Output is correct
18 Correct 9 ms 640 KB Output is correct
19 Correct 10 ms 640 KB Output is correct
20 Correct 9 ms 640 KB Output is correct
21 Correct 9 ms 640 KB Output is correct
22 Correct 9 ms 640 KB Output is correct
23 Correct 10 ms 640 KB Output is correct
24 Correct 1247 ms 34300 KB Output is correct
25 Correct 1047 ms 35068 KB Output is correct
26 Correct 504 ms 34176 KB Output is correct
27 Correct 1069 ms 39548 KB Output is correct
28 Correct 796 ms 35068 KB Output is correct
29 Correct 649 ms 35068 KB Output is correct
30 Correct 1178 ms 37116 KB Output is correct
31 Correct 390 ms 28348 KB Output is correct
32 Correct 91 ms 6592 KB Output is correct
33 Correct 883 ms 35524 KB Output is correct
34 Correct 1060 ms 34692 KB Output is correct
35 Correct 1115 ms 37244 KB Output is correct
36 Correct 1159 ms 37244 KB Output is correct
37 Correct 556 ms 34148 KB Output is correct
38 Correct 1093 ms 39636 KB Output is correct
39 Correct 975 ms 39560 KB Output is correct
40 Correct 981 ms 39680 KB Output is correct
41 Correct 4 ms 384 KB Output is correct
42 Correct 1239 ms 37244 KB Output is correct
43 Correct 903 ms 35548 KB Output is correct
44 Correct 1094 ms 34588 KB Output is correct
45 Correct 1182 ms 37244 KB Output is correct
46 Correct 2985 ms 168992 KB Output is correct
47 Correct 6317 ms 196176 KB Output is correct
48 Correct 5352 ms 196380 KB Output is correct
49 Correct 5410 ms 196376 KB Output is correct
50 Correct 7706 ms 184704 KB Output is correct
51 Correct 5311 ms 174364 KB Output is correct
52 Correct 6357 ms 162236 KB Output is correct
53 Correct 7250 ms 184220 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 994 ms 36988 KB Output is correct
2 Correct 932 ms 36836 KB Output is correct
3 Correct 671 ms 35068 KB Output is correct
4 Correct 817 ms 36708 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 885 ms 34820 KB Output is correct
7 Correct 195 ms 28728 KB Output is correct
8 Correct 100 ms 6592 KB Output is correct
9 Correct 679 ms 35068 KB Output is correct
10 Correct 937 ms 39548 KB Output is correct
11 Correct 635 ms 35060 KB Output is correct
12 Correct 4 ms 384 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 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 4 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 4 ms 384 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 7 ms 640 KB Output is correct
29 Correct 9 ms 640 KB Output is correct
30 Correct 10 ms 640 KB Output is correct
31 Correct 9 ms 640 KB Output is correct
32 Correct 9 ms 640 KB Output is correct
33 Correct 9 ms 640 KB Output is correct
34 Correct 10 ms 640 KB Output is correct
35 Correct 1247 ms 34300 KB Output is correct
36 Correct 1047 ms 35068 KB Output is correct
37 Correct 504 ms 34176 KB Output is correct
38 Correct 1069 ms 39548 KB Output is correct
39 Correct 796 ms 35068 KB Output is correct
40 Correct 649 ms 35068 KB Output is correct
41 Correct 1178 ms 37116 KB Output is correct
42 Correct 390 ms 28348 KB Output is correct
43 Correct 91 ms 6592 KB Output is correct
44 Correct 883 ms 35524 KB Output is correct
45 Correct 1060 ms 34692 KB Output is correct
46 Correct 1115 ms 37244 KB Output is correct
47 Correct 1159 ms 37244 KB Output is correct
48 Correct 556 ms 34148 KB Output is correct
49 Correct 1093 ms 39636 KB Output is correct
50 Correct 975 ms 39560 KB Output is correct
51 Correct 981 ms 39680 KB Output is correct
52 Correct 4 ms 384 KB Output is correct
53 Correct 1239 ms 37244 KB Output is correct
54 Correct 903 ms 35548 KB Output is correct
55 Correct 1094 ms 34588 KB Output is correct
56 Correct 1182 ms 37244 KB Output is correct
57 Correct 542 ms 34560 KB Output is correct
58 Correct 1119 ms 53844 KB Output is correct
59 Correct 1012 ms 51708 KB Output is correct
60 Correct 998 ms 51672 KB Output is correct
61 Correct 1238 ms 48124 KB Output is correct
62 Correct 5 ms 384 KB Output is correct
63 Correct 1262 ms 51004 KB Output is correct
64 Correct 919 ms 48116 KB Output is correct
65 Correct 1094 ms 49064 KB Output is correct
66 Correct 1170 ms 44668 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 994 ms 36988 KB Output is correct
2 Correct 932 ms 36836 KB Output is correct
3 Correct 671 ms 35068 KB Output is correct
4 Correct 817 ms 36708 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 885 ms 34820 KB Output is correct
7 Correct 195 ms 28728 KB Output is correct
8 Correct 100 ms 6592 KB Output is correct
9 Correct 679 ms 35068 KB Output is correct
10 Correct 937 ms 39548 KB Output is correct
11 Correct 635 ms 35060 KB Output is correct
12 Correct 4 ms 384 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 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 4 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 4 ms 384 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 7 ms 640 KB Output is correct
29 Correct 9 ms 640 KB Output is correct
30 Correct 10 ms 640 KB Output is correct
31 Correct 9 ms 640 KB Output is correct
32 Correct 9 ms 640 KB Output is correct
33 Correct 9 ms 640 KB Output is correct
34 Correct 10 ms 640 KB Output is correct
35 Correct 1247 ms 34300 KB Output is correct
36 Correct 1047 ms 35068 KB Output is correct
37 Correct 504 ms 34176 KB Output is correct
38 Correct 1069 ms 39548 KB Output is correct
39 Correct 796 ms 35068 KB Output is correct
40 Correct 649 ms 35068 KB Output is correct
41 Correct 1178 ms 37116 KB Output is correct
42 Correct 390 ms 28348 KB Output is correct
43 Correct 91 ms 6592 KB Output is correct
44 Correct 883 ms 35524 KB Output is correct
45 Correct 1060 ms 34692 KB Output is correct
46 Correct 1115 ms 37244 KB Output is correct
47 Correct 1159 ms 37244 KB Output is correct
48 Correct 556 ms 34148 KB Output is correct
49 Correct 1093 ms 39636 KB Output is correct
50 Correct 975 ms 39560 KB Output is correct
51 Correct 981 ms 39680 KB Output is correct
52 Correct 4 ms 384 KB Output is correct
53 Correct 1239 ms 37244 KB Output is correct
54 Correct 903 ms 35548 KB Output is correct
55 Correct 1094 ms 34588 KB Output is correct
56 Correct 1182 ms 37244 KB Output is correct
57 Correct 2985 ms 168992 KB Output is correct
58 Correct 6317 ms 196176 KB Output is correct
59 Correct 5352 ms 196380 KB Output is correct
60 Correct 5410 ms 196376 KB Output is correct
61 Correct 7706 ms 184704 KB Output is correct
62 Correct 5311 ms 174364 KB Output is correct
63 Correct 6357 ms 162236 KB Output is correct
64 Correct 7250 ms 184220 KB Output is correct
65 Correct 542 ms 34560 KB Output is correct
66 Correct 1119 ms 53844 KB Output is correct
67 Correct 1012 ms 51708 KB Output is correct
68 Correct 998 ms 51672 KB Output is correct
69 Correct 1238 ms 48124 KB Output is correct
70 Correct 5 ms 384 KB Output is correct
71 Correct 1262 ms 51004 KB Output is correct
72 Correct 919 ms 48116 KB Output is correct
73 Correct 1094 ms 49064 KB Output is correct
74 Correct 1170 ms 44668 KB Output is correct
75 Correct 3143 ms 240256 KB Output is correct
76 Correct 6227 ms 268060 KB Output is correct
77 Correct 5490 ms 255080 KB Output is correct
78 Correct 5412 ms 254880 KB Output is correct
79 Correct 7705 ms 255060 KB Output is correct
80 Correct 5465 ms 235380 KB Output is correct
81 Correct 5962 ms 240068 KB Output is correct
82 Correct 7792 ms 222924 KB Output is correct
83 Correct 7468 ms 242328 KB Output is correct