답안 #1114770

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1114770 2024-11-19T14:53:47 Z VinhLuu Tourism (JOI23_tourism) C++17
100 / 100
573 ms 81992 KB
#include <bits/stdc++.h>
#define ll long long
#define all(lpv) lpv.begin(), lpv.end()
#define fi first
#define se second
using namespace std;

typedef pair<int,int> pii;
const int N = 2e5 + 5;

int n, m, q, L[N], R[N], c[N];
vector<int> p[N];

namespace AC{
  struct BIT{
    int bit[N];
    void update(int x,int val){
      if(!x) return;
      for(int i = x; i <= m; i += i & -i) bit[i] += val;
    }
    int get(int x){
      int ret = 0;
      for(int i = x; i; i -= i & -i) ret += bit[i];
      return ret;
    }
  } tree;

  int in[N], en[N], demin, be[N], head[N], scc = 1, pa[N], f[22][N], sub[N], d[N];

  void cal(int u,int v){
    sub[u] = 1;
    for(auto j : p[u]) if(j != v){
      pa[j] = u;
      d[j] = d[u] + 1;
      cal(j, u);
      sub[u] += sub[j];
    }
  }

  void hld(int u,int v){
    in[u] = ++demin;
    if(u == 1) for(int i = 0; i <= 18; i ++) f[i][u] = u;
    else{
      f[0][u] = v;
      for(int i= 1; i <= 18; i ++) f[i][u] = f[i - 1][f[i - 1][u]];
    }

    if(!head[scc]) head[scc] = u;
    be[u] = scc;

    int mx = 0;
    for(auto j : p[u]) if(j != v && sub[j] > sub[mx]) mx = j;

    if(mx) hld(mx, u);

    for(auto j : p[u]) if(j != v && j != mx){
      scc++;
      hld(j, u);
    }

    en[u] = demin;

  }

  bool kt(int u,int v){
    return in[u] <= in[v] && in[v] <= en[u];
  }

  int LCA(int u,int v){
    if(kt(u, v)) return u;
    int lca = u;
    for(int i = 18; i >= 0; i --) if(kt(f[i][u], v)) lca = f[i][u];
    else u = f[i][u];
    return lca;
  }

  struct interval{
    int nxt[N], wt[N];
    set<int> pot;
    void build(){
      nxt[1] = n + 1;
      pot.insert(1);
      wt[1] = 0;
    }

    void change(int l,int r,int val){
      if(l > r) return;
      auto _left = pot.upper_bound(l);
      _left--;
      auto _right = pot.upper_bound(r);
      _right--;

      int pl = (*_left);
      int pr = (*_right);

      if(pl == pr){
        tree.update(wt[pl], - nxt[pl] + pl);
        int ending = nxt[pl];
        if(pl < l){
          nxt[pl] = l;
          tree.update(wt[pl], l - pl);
        }
        if(r < ending - 1){
          pot.insert(r + 1);
          wt[r + 1] = wt[pl];
          nxt[r + 1] = ending;
          tree.update(wt[r + 1], ending - r - 1);
        }
        pot.insert(l);
        nxt[l] = r + 1;
        wt[l] = val;
        tree.update(val, r - l + 1);
        return;
      }

      int nxt_left = nxt[pl];
      int nxt_right = nxt[pr];
      tree.update(wt[pl], - nxt_left + pl);
      tree.update(wt[pr], - nxt_right + pr);
      pot.erase(pr);

      if(pl < l){
        nxt[pl] = l;
        tree.update(wt[pl], l - pl);
      }

      if(r < nxt_right - 1){
        pot.insert(r + 1);
        wt[r + 1] = wt[pr];
        nxt[r + 1] = nxt_right;
        tree.update(wt[r + 1], nxt_right - r - 1);
      }

      int tmp = nxt_left;

      while(tmp < pr){
        pot.erase(tmp);
        tree.update(wt[tmp], - nxt[tmp] + tmp);
        tmp = nxt[tmp];
      }

      pot.insert(l);
      nxt[l] = r + 1;
      wt[l] = val;
      tree.update(val, r - l + 1);
    }
  } data;

  void add(int u,int id){
    while(true){
      if(be[u] == be[1]){
        data.change(in[1], in[u], id);
        return;
      }
      int x = head[be[u]];
      data.change(in[x], in[u], id);
      u = pa[x];
    }
  }

  int kq[N];
  vector<int> Q[N];

  int Max[22][N], Min[22][N], LG[N];

  int get_max(int l,int r){
    int k = LG[r - l + 1];
    if(in[Max[k][l]] > in[Max[k][r - (1 << k) + 1]]) return Max[k][l];
    return Max[k][r - (1 << k) + 1];
  }

  int get_min(int l,int r){
    int k = LG[r - l + 1];
    if(in[Min[k][l]] < in[Min[k][r - (1 << k) + 1]]) return Min[k][l];
    return Min[k][r - (1 << k) + 1];
  }

  void solve(){
    cal(1, 0);
    hld(1, 0);
    LG[1] = 0;
    for(int i = 2; i <= m; i ++) LG[i] = LG[i / 2] + 1;

    for(int i = m; i >= 1; i --){
      Max[0][i] = c[i];
      Min[0][i] = c[i];
      for(int j = 1; j <= 18 && i + (1 << j) - 1 <= m; j ++){
        if(in[Max[j - 1][i]] > in[Max[j - 1][i + (1 << (j - 1))]]) Max[j][i] = Max[j - 1][i];
        else Max[j][i] = Max[j - 1][i + (1 << (j - 1))];
        if(in[Min[j - 1][i]] < in[Min[j - 1][i + (1 << (j - 1))]]) Min[j][i] = Min[j - 1][i];
        else Min[j][i] = Min[j - 1][i + (1 << (j - 1))];
      }
    }

    for(int i = 1; i <= q; i ++){
      Q[R[i]].push_back(i);
    }

    data.build();

    for(int r = 1; r <= m; r ++){
      add(c[r], r);
      for(auto j : Q[r]){
        int mi = get_min(L[j], r);
        int mx = get_max(L[j], r);
        kq[j] = tree.get(m) - tree.get(L[j] - 1) - d[LCA(mx, mi)];
      }
    }
    for(int i = 1; i <= q; i ++) cout << kq[i] << "\n";
  }
}

namespace sub1{
  int in[N], en[N], demin, f[22][N], d[N];
  void pre(int u,int v){
    in[u] = ++demin;
    if(u == 1) for(int i = 0; i <= 15; i ++) f[i][u] = u;
    else{
      f[0][u] = v;
      for(int i = 1; i <= 15; i ++) f[i][u] = f[i - 1][f[i - 1][u]];
    }
    for(auto j : p[u]) if(j != v){
      d[j] = d[u] + 1;
      pre(j, u);
    }
    en[u] = demin;
  }
  bool kt(int u,int v){
    return in[u] <= in[v] && in[v] <= en[u];
  }

  int LCA(int u,int v){
    if(kt(u, v)) return u;
    int kq = u;
    for(int i = 15; i >= 0; i --) if(kt(f[i][u], v)) kq = f[i][u];
    else u = f[i][u];
    return kq;
  }

  void solve(){
    pre(1, 0);
    for(int k = 1; k <= q; k ++){
      int l = L[k], r = R[k];
      int ans = 0;
      vector<int> st;

      int mi = 0, mx = 0;

      for(int j = l; j <= r; j ++){
        int i = c[j];
        if(!in[mi] || in[mi] > in[i]) mi = i;
        if(!in[mx] || in[mx] < in[i]) mx = i;
        st.push_back(in[c[j]]);
      }

      sort(all(st));

      for(int i = 1; i <= n; i ++){
        auto _left = lower_bound(all(st), in[i]) - st.begin();
        auto _right = upper_bound(all(st), en[i]) - st.begin() - 1;
        if(0 <= _left && _left <= _right && _right <= (int)st.size() - 1) ans++;
      }

      cout << ans - d[LCA(mx, mi)] << "\n";
    }
  }
}


signed main(){
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define task "v"
  if(fopen(task ".inp","r")){
    freopen(task ".inp","r",stdin);
    freopen(task ".out","w",stdout);
  }

  cin >> n >> m >> q;
  for(int i = 1; i < n; i ++){
    int x, y; cin >> x >> y;
    p[x].push_back(y);
    p[y].push_back(x);
  }

  for(int i = 1; i <= m; i ++) cin >> c[i];

  for(int i = 1; i <= q; i ++){
    cin >> L[i] >> R[i];
  }

  AC :: solve();
}

Compilation message

tourism.cpp: In function 'int main()':
tourism.cpp:274:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  274 |     freopen(task ".inp","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
tourism.cpp:275:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  275 |     freopen(task ".out","w",stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 39248 KB Output is correct
2 Correct 6 ms 41296 KB Output is correct
3 Correct 6 ms 39248 KB Output is correct
4 Correct 7 ms 47596 KB Output is correct
5 Correct 6 ms 47696 KB Output is correct
6 Correct 7 ms 47696 KB Output is correct
7 Correct 7 ms 47696 KB Output is correct
8 Correct 6 ms 47696 KB Output is correct
9 Correct 7 ms 49904 KB Output is correct
10 Correct 7 ms 49744 KB Output is correct
11 Correct 8 ms 49744 KB Output is correct
12 Correct 7 ms 49744 KB Output is correct
13 Correct 7 ms 49744 KB Output is correct
14 Correct 8 ms 49744 KB Output is correct
15 Correct 7 ms 49772 KB Output is correct
16 Correct 7 ms 49744 KB Output is correct
17 Correct 6 ms 49744 KB Output is correct
18 Correct 7 ms 49744 KB Output is correct
19 Correct 7 ms 49744 KB Output is correct
20 Correct 7 ms 49744 KB Output is correct
21 Correct 8 ms 49744 KB Output is correct
22 Correct 7 ms 49744 KB Output is correct
23 Correct 7 ms 49744 KB Output is correct
24 Correct 7 ms 49744 KB Output is correct
25 Correct 8 ms 49744 KB Output is correct
26 Correct 7 ms 49744 KB Output is correct
27 Correct 7 ms 47696 KB Output is correct
28 Correct 6 ms 37200 KB Output is correct
29 Correct 7 ms 49744 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 39248 KB Output is correct
2 Correct 6 ms 41296 KB Output is correct
3 Correct 6 ms 39248 KB Output is correct
4 Correct 7 ms 47596 KB Output is correct
5 Correct 6 ms 47696 KB Output is correct
6 Correct 7 ms 47696 KB Output is correct
7 Correct 7 ms 47696 KB Output is correct
8 Correct 6 ms 47696 KB Output is correct
9 Correct 7 ms 49904 KB Output is correct
10 Correct 7 ms 49744 KB Output is correct
11 Correct 8 ms 49744 KB Output is correct
12 Correct 7 ms 49744 KB Output is correct
13 Correct 7 ms 49744 KB Output is correct
14 Correct 8 ms 49744 KB Output is correct
15 Correct 7 ms 49772 KB Output is correct
16 Correct 7 ms 49744 KB Output is correct
17 Correct 6 ms 49744 KB Output is correct
18 Correct 7 ms 49744 KB Output is correct
19 Correct 7 ms 49744 KB Output is correct
20 Correct 7 ms 49744 KB Output is correct
21 Correct 8 ms 49744 KB Output is correct
22 Correct 7 ms 49744 KB Output is correct
23 Correct 7 ms 49744 KB Output is correct
24 Correct 7 ms 49744 KB Output is correct
25 Correct 8 ms 49744 KB Output is correct
26 Correct 7 ms 49744 KB Output is correct
27 Correct 7 ms 47696 KB Output is correct
28 Correct 6 ms 37200 KB Output is correct
29 Correct 7 ms 49744 KB Output is correct
30 Correct 9 ms 54016 KB Output is correct
31 Correct 9 ms 53840 KB Output is correct
32 Correct 10 ms 53840 KB Output is correct
33 Correct 10 ms 54072 KB Output is correct
34 Correct 12 ms 53864 KB Output is correct
35 Correct 10 ms 53840 KB Output is correct
36 Correct 10 ms 53840 KB Output is correct
37 Correct 10 ms 53840 KB Output is correct
38 Correct 8 ms 54020 KB Output is correct
39 Correct 10 ms 54096 KB Output is correct
40 Correct 9 ms 54096 KB Output is correct
41 Correct 9 ms 54096 KB Output is correct
42 Correct 8 ms 54096 KB Output is correct
43 Correct 9 ms 54096 KB Output is correct
44 Correct 9 ms 53844 KB Output is correct
45 Correct 11 ms 53840 KB Output is correct
46 Correct 9 ms 53840 KB Output is correct
47 Correct 9 ms 53840 KB Output is correct
48 Correct 8 ms 53840 KB Output is correct
49 Correct 9 ms 53840 KB Output is correct
50 Correct 9 ms 54096 KB Output is correct
51 Correct 9 ms 53920 KB Output is correct
52 Correct 11 ms 54096 KB Output is correct
53 Correct 8 ms 54108 KB Output is correct
54 Correct 8 ms 53996 KB Output is correct
55 Correct 9 ms 54096 KB Output is correct
56 Correct 8 ms 51792 KB Output is correct
57 Correct 7 ms 37456 KB Output is correct
58 Correct 12 ms 53840 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 41592 KB Output is correct
2 Correct 6 ms 47696 KB Output is correct
3 Correct 8 ms 51792 KB Output is correct
4 Correct 94 ms 73036 KB Output is correct
5 Correct 74 ms 73532 KB Output is correct
6 Correct 83 ms 75688 KB Output is correct
7 Correct 141 ms 69588 KB Output is correct
8 Correct 115 ms 76036 KB Output is correct
9 Correct 111 ms 80988 KB Output is correct
10 Correct 114 ms 79176 KB Output is correct
11 Correct 110 ms 81992 KB Output is correct
12 Correct 86 ms 80852 KB Output is correct
13 Correct 87 ms 70472 KB Output is correct
14 Correct 84 ms 74624 KB Output is correct
15 Correct 46 ms 52424 KB Output is correct
16 Correct 105 ms 80788 KB Output is correct
17 Correct 71 ms 54856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 21072 KB Output is correct
2 Correct 146 ms 45128 KB Output is correct
3 Correct 252 ms 61476 KB Output is correct
4 Correct 206 ms 63048 KB Output is correct
5 Correct 318 ms 60488 KB Output is correct
6 Correct 389 ms 68220 KB Output is correct
7 Correct 311 ms 56548 KB Output is correct
8 Correct 273 ms 68168 KB Output is correct
9 Correct 272 ms 68176 KB Output is correct
10 Correct 284 ms 73320 KB Output is correct
11 Correct 280 ms 73288 KB Output is correct
12 Correct 307 ms 73288 KB Output is correct
13 Correct 323 ms 73800 KB Output is correct
14 Correct 325 ms 74736 KB Output is correct
15 Correct 299 ms 78448 KB Output is correct
16 Correct 273 ms 73800 KB Output is correct
17 Correct 326 ms 65256 KB Output is correct
18 Correct 269 ms 73800 KB Output is correct
19 Correct 166 ms 70216 KB Output is correct
20 Correct 164 ms 65360 KB Output is correct
21 Correct 166 ms 70376 KB Output is correct
22 Correct 177 ms 70228 KB Output is correct
23 Correct 193 ms 66888 KB Output is correct
24 Correct 182 ms 61768 KB Output is correct
25 Correct 183 ms 68940 KB Output is correct
26 Correct 175 ms 69012 KB Output is correct
27 Correct 192 ms 69192 KB Output is correct
28 Correct 209 ms 67144 KB Output is correct
29 Correct 193 ms 70472 KB Output is correct
30 Correct 204 ms 61256 KB Output is correct
31 Correct 193 ms 70728 KB Output is correct
32 Correct 207 ms 71376 KB Output is correct
33 Correct 233 ms 72888 KB Output is correct
34 Correct 215 ms 67400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 39248 KB Output is correct
2 Correct 6 ms 47604 KB Output is correct
3 Correct 8 ms 51792 KB Output is correct
4 Correct 396 ms 71684 KB Output is correct
5 Correct 383 ms 68424 KB Output is correct
6 Correct 468 ms 67912 KB Output is correct
7 Correct 510 ms 70472 KB Output is correct
8 Correct 540 ms 76872 KB Output is correct
9 Correct 573 ms 76872 KB Output is correct
10 Correct 431 ms 73032 KB Output is correct
11 Correct 421 ms 68680 KB Output is correct
12 Correct 473 ms 77784 KB Output is correct
13 Correct 461 ms 77832 KB Output is correct
14 Correct 58 ms 66120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 39248 KB Output is correct
2 Correct 6 ms 41296 KB Output is correct
3 Correct 6 ms 39248 KB Output is correct
4 Correct 7 ms 47596 KB Output is correct
5 Correct 6 ms 47696 KB Output is correct
6 Correct 7 ms 47696 KB Output is correct
7 Correct 7 ms 47696 KB Output is correct
8 Correct 6 ms 47696 KB Output is correct
9 Correct 7 ms 49904 KB Output is correct
10 Correct 7 ms 49744 KB Output is correct
11 Correct 8 ms 49744 KB Output is correct
12 Correct 7 ms 49744 KB Output is correct
13 Correct 7 ms 49744 KB Output is correct
14 Correct 8 ms 49744 KB Output is correct
15 Correct 7 ms 49772 KB Output is correct
16 Correct 7 ms 49744 KB Output is correct
17 Correct 6 ms 49744 KB Output is correct
18 Correct 7 ms 49744 KB Output is correct
19 Correct 7 ms 49744 KB Output is correct
20 Correct 7 ms 49744 KB Output is correct
21 Correct 8 ms 49744 KB Output is correct
22 Correct 7 ms 49744 KB Output is correct
23 Correct 7 ms 49744 KB Output is correct
24 Correct 7 ms 49744 KB Output is correct
25 Correct 8 ms 49744 KB Output is correct
26 Correct 7 ms 49744 KB Output is correct
27 Correct 7 ms 47696 KB Output is correct
28 Correct 6 ms 37200 KB Output is correct
29 Correct 7 ms 49744 KB Output is correct
30 Correct 9 ms 54016 KB Output is correct
31 Correct 9 ms 53840 KB Output is correct
32 Correct 10 ms 53840 KB Output is correct
33 Correct 10 ms 54072 KB Output is correct
34 Correct 12 ms 53864 KB Output is correct
35 Correct 10 ms 53840 KB Output is correct
36 Correct 10 ms 53840 KB Output is correct
37 Correct 10 ms 53840 KB Output is correct
38 Correct 8 ms 54020 KB Output is correct
39 Correct 10 ms 54096 KB Output is correct
40 Correct 9 ms 54096 KB Output is correct
41 Correct 9 ms 54096 KB Output is correct
42 Correct 8 ms 54096 KB Output is correct
43 Correct 9 ms 54096 KB Output is correct
44 Correct 9 ms 53844 KB Output is correct
45 Correct 11 ms 53840 KB Output is correct
46 Correct 9 ms 53840 KB Output is correct
47 Correct 9 ms 53840 KB Output is correct
48 Correct 8 ms 53840 KB Output is correct
49 Correct 9 ms 53840 KB Output is correct
50 Correct 9 ms 54096 KB Output is correct
51 Correct 9 ms 53920 KB Output is correct
52 Correct 11 ms 54096 KB Output is correct
53 Correct 8 ms 54108 KB Output is correct
54 Correct 8 ms 53996 KB Output is correct
55 Correct 9 ms 54096 KB Output is correct
56 Correct 8 ms 51792 KB Output is correct
57 Correct 7 ms 37456 KB Output is correct
58 Correct 12 ms 53840 KB Output is correct
59 Correct 7 ms 41592 KB Output is correct
60 Correct 6 ms 47696 KB Output is correct
61 Correct 8 ms 51792 KB Output is correct
62 Correct 94 ms 73036 KB Output is correct
63 Correct 74 ms 73532 KB Output is correct
64 Correct 83 ms 75688 KB Output is correct
65 Correct 141 ms 69588 KB Output is correct
66 Correct 115 ms 76036 KB Output is correct
67 Correct 111 ms 80988 KB Output is correct
68 Correct 114 ms 79176 KB Output is correct
69 Correct 110 ms 81992 KB Output is correct
70 Correct 86 ms 80852 KB Output is correct
71 Correct 87 ms 70472 KB Output is correct
72 Correct 84 ms 74624 KB Output is correct
73 Correct 46 ms 52424 KB Output is correct
74 Correct 105 ms 80788 KB Output is correct
75 Correct 71 ms 54856 KB Output is correct
76 Correct 6 ms 21072 KB Output is correct
77 Correct 146 ms 45128 KB Output is correct
78 Correct 252 ms 61476 KB Output is correct
79 Correct 206 ms 63048 KB Output is correct
80 Correct 318 ms 60488 KB Output is correct
81 Correct 389 ms 68220 KB Output is correct
82 Correct 311 ms 56548 KB Output is correct
83 Correct 273 ms 68168 KB Output is correct
84 Correct 272 ms 68176 KB Output is correct
85 Correct 284 ms 73320 KB Output is correct
86 Correct 280 ms 73288 KB Output is correct
87 Correct 307 ms 73288 KB Output is correct
88 Correct 323 ms 73800 KB Output is correct
89 Correct 325 ms 74736 KB Output is correct
90 Correct 299 ms 78448 KB Output is correct
91 Correct 273 ms 73800 KB Output is correct
92 Correct 326 ms 65256 KB Output is correct
93 Correct 269 ms 73800 KB Output is correct
94 Correct 166 ms 70216 KB Output is correct
95 Correct 164 ms 65360 KB Output is correct
96 Correct 166 ms 70376 KB Output is correct
97 Correct 177 ms 70228 KB Output is correct
98 Correct 193 ms 66888 KB Output is correct
99 Correct 182 ms 61768 KB Output is correct
100 Correct 183 ms 68940 KB Output is correct
101 Correct 175 ms 69012 KB Output is correct
102 Correct 192 ms 69192 KB Output is correct
103 Correct 209 ms 67144 KB Output is correct
104 Correct 193 ms 70472 KB Output is correct
105 Correct 204 ms 61256 KB Output is correct
106 Correct 193 ms 70728 KB Output is correct
107 Correct 207 ms 71376 KB Output is correct
108 Correct 233 ms 72888 KB Output is correct
109 Correct 215 ms 67400 KB Output is correct
110 Correct 5 ms 39248 KB Output is correct
111 Correct 6 ms 47604 KB Output is correct
112 Correct 8 ms 51792 KB Output is correct
113 Correct 396 ms 71684 KB Output is correct
114 Correct 383 ms 68424 KB Output is correct
115 Correct 468 ms 67912 KB Output is correct
116 Correct 510 ms 70472 KB Output is correct
117 Correct 540 ms 76872 KB Output is correct
118 Correct 573 ms 76872 KB Output is correct
119 Correct 431 ms 73032 KB Output is correct
120 Correct 421 ms 68680 KB Output is correct
121 Correct 473 ms 77784 KB Output is correct
122 Correct 461 ms 77832 KB Output is correct
123 Correct 58 ms 66120 KB Output is correct
124 Correct 337 ms 74952 KB Output is correct
125 Correct 244 ms 72776 KB Output is correct
126 Correct 393 ms 77476 KB Output is correct
127 Correct 350 ms 77532 KB Output is correct
128 Correct 322 ms 77484 KB Output is correct
129 Correct 346 ms 77588 KB Output is correct
130 Correct 317 ms 77624 KB Output is correct
131 Correct 155 ms 80968 KB Output is correct
132 Correct 142 ms 81984 KB Output is correct
133 Correct 162 ms 78100 KB Output is correct
134 Correct 243 ms 74568 KB Output is correct
135 Correct 227 ms 74568 KB Output is correct
136 Correct 219 ms 74824 KB Output is correct
137 Correct 181 ms 78792 KB Output is correct
138 Correct 180 ms 78716 KB Output is correct
139 Correct 184 ms 78784 KB Output is correct
140 Correct 164 ms 78752 KB Output is correct
141 Correct 173 ms 78664 KB Output is correct
142 Correct 169 ms 78788 KB Output is correct
143 Correct 52 ms 44736 KB Output is correct
144 Correct 332 ms 77360 KB Output is correct