Submission #735079

# Submission time Handle Problem Language Result Execution time Memory
735079 2023-05-03T13:15:39 Z cadmiumsky Jail (JOI22_jail) C++17
100 / 100
1553 ms 338600 KB
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
using namespace std;

using ll = long long;
using ld = long double;

const int nmax = 5e5 + 5;
//#define int ll
#define sz(x) ((int)(x).size())

using pii = pair<int,int>;
using tii = tuple<int,int,int>;

pii chains[nmax];

namespace Tree {
  
  int pin[nmax], pout[nmax], area[nmax], inp;
  int p[nmax], jump[nmax], d[nmax];
  int pch[nmax];
  
  namespace G {
      vector<vector<int>> g;
      vector<int> occ;
      
      // Low level
      int newnode() { 
        g.emplace_back();
        occ.emplace_back(0);
        return sz(g) - 1;
      }
      void addedge(int x, int y) {
        if(x != 0 && y != 0)
          g[x].emplace_back(y);
      }
      bool dfs(int node) {
        if(occ[node] == 2) return 0;
        if(occ[node] == 1) return 1;
        occ[node] = 1;
        bool ok = 0;
        for(auto x : g[node])
          ok |= dfs(x);
        occ[node] = 2;
        return ok;
      }
      bool findcyc() {
        bool found = 0;
        for(int i = 0; !found && i < sz(g); i++) {
          found |= dfs(i);
        }
        return found;
      }
      // High Level
      
      int inspre[17][nmax]; // sus in jos
      int dinspre[17][nmax]; // jos in sus
      int lg2[nmax];
      
      void init(vector<int> T, vector<int> A) {
        int n = sz(T);
        for(int i = 2; i < n; i++)
          lg2[i] = lg2[i >> 1] + 1;
        for(int i = 0; i < n; i++) 
          inspre[0][i] = T[i];
        for(int step = 1; step < 17; step++) {
          for(int i = 0; i + (1 << step) <= n; i++) {
            inspre[step][i] = newnode();
            addedge(inspre[step][i], inspre[step - 1][i]);
            addedge(inspre[step][i], inspre[step - 1][i + (1 << step - 1)]);
          }
        }
        n = sz(A);
        for(int i = 0; i < n; i++) 
          dinspre[0][i] = A[i];
        for(int step = 1; step < 17; step++) {
          for(int i = 0; i + (1 << step) <= n; i++) {
            dinspre[step][i] = newnode();
            addedge(dinspre[step - 1][i], dinspre[step][i]);
            addedge(dinspre[step - 1][i + (1 << step - 1)], dinspre[step][i]);
          }
        }
        return;
      }
      void pushdown(int X, int l, int r) {
        int step = lg2[r - l + 1];
        addedge(X, inspre[step][l]);
        addedge(X, inspre[step][r - (1 << step) + 1]);
        //cerr << X << " --> " << l << ", " << r << '\n';
      }
      void pushup(int X, int l, int r) {
        int step = lg2[r - l + 1];
        addedge(dinspre[step][r - (1 << step) + 1], X);
        addedge(dinspre[step][l], X);
        //cerr << X << " <-- " << l << ", " << r << '\n';
      }
      void push(int X, int l, int r, int pass = 0) {
        if(r < l) return;
        int mid = -1;
        if(pass == 0) mid = pin[chains[X].first];
        else if(pass == 1) mid = pin[chains[X].second];
        
        if(l <= mid && mid <= r) {
          push(X, l, mid - 1, pass + 1),
          push(X, mid + 1, r, pass + 1);
          return;
        }
        if(pass != 2) {
          push(X, l, r, pass + 1);
          return;
        }
        pushup(X, l, r);
        pushdown(X, l, r);
        return;
      }
      
      void init(int n) {
        g.clear();
        occ.clear();
        g.resize(n + 1);
        occ.resize(n + 1, 0);
      }
    }
  
  vector<int> g[nmax];
  
  void initstd(int node, int f) {
    p[node] = f;
    jump[node] = f;
    d[node] = d[f] + 1;
    if(d[jump[f]] - d[jump[jump[f]]] == d[f] - d[jump[f]])
      jump[node] = jump[jump[f]];
      
    //cerr << node << '>' << jump[node] << '\n';
      
    area[node] = 1;
    for(auto x : g[node]) {
      if(x == f) continue;
      initstd(x, node);
      area[node] += area[x];
    }
    return;
  }
  
  bool isanc(int x, int y) { return pin[x] <= pin[y] && pout[y] <= pout[x]; }
  int lca(int x, int y) {
    while(!isanc(x, y)) {
      if(!isanc(jump[x], y)) x = jump[x];
      x = p[x];
    }
    return x;
  }
  
  namespace HLD {
    
    void initp(int node, int f) {
      pin[node] = inp++;
      //cerr << node << ' ' << inp - 1 << '\n';
      int atrs = -1;
      for(auto x : g[node]) {
        if(x == f) continue;
        if(atrs == -1 || area[atrs] < area[x]) atrs = x;
      }
      if(atrs == -1) { pout[node] = inp - 1; return; }
      pch[atrs] = pch[node];
      initp(atrs, node);
      for(auto x : g[node]) {
        if(x == f || x == atrs) continue;
        pch[x] = x;
        initp(x, node);
      }
      
      pout[node] = inp - 1;
      return;
    }
    void pushQ(int x, int y, int X) {
      if(isanc(x, y) && x != y) return;
      //cerr << X << '\t' << x << ' ' << y << '\n';
      if(pch[x] == pch[y]) { G::push(X, pin[y], pin[x]); return; }
      G::push(X, pin[pch[x]], pin[x]);
      pushQ(p[pch[x]], y, X);
    }
  }
  

  
  void init(int n) {
    inp = 0;
    for(int i = 0; i <= n; i++)
      g[i].clear();
  }
}

void driver() {
  int n, m;
  cin >> n;
  Tree::init(n);
  for(int i = 1, x, y; i < n; i++) {
    cin >> x >> y;
    Tree::g[x].emplace_back(y);
    Tree::g[y].emplace_back(x);
  }
  Tree::g[0].emplace_back(1);
  Tree::g[1].emplace_back(0);
  Tree::initstd(0, 0);
  Tree::HLD::initp(0, 0);
  cin >> m;
  vector<int> ends(n + 1), starts(n + 1);
  for(int i = 1, S, T; i <= m; i++) {
    cin >> S >> T;
    starts[Tree::pin[S]] = i;
    ends[Tree::pin[T]] = i;
    chains[i] = pii{S, T};
  }
  //for(auto x : ends) cerr << x << ' '; cerr << '\n';
  //for(auto x : starts) cerr << x << ' '; cerr << '\n';
  
  Tree::G::init(m);
  Tree::G::init(ends, starts);
  for(int i = 1, S, T; i <= m; i++) {
    tie(S, T) = chains[i];
    int L = Tree::lca(S, T);
    Tree::HLD::pushQ(S, L, i);
    Tree::HLD::pushQ(T, L, i);
    Tree::G::pushdown(i, Tree::pin[S], Tree::pin[S]);
    Tree::G::pushup(i, Tree::pin[T], Tree::pin[T]);
  }
  cout << (Tree::G::findcyc()? "No\n" : "Yes\n");
}

signed main() {
  int T;
  cin >> T;
  while(T--) driver();
  
}

/**
      Anul asta se da centroid.
-- Surse oficiale
*/

Compilation message

jail.cpp: In function 'void Tree::G::init(std::vector<int>, std::vector<int>)':
jail.cpp:70:70: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   70 |             addedge(inspre[step][i], inspre[step - 1][i + (1 << step - 1)]);
      |                                                                 ~~~~~^~~
jail.cpp:80:54: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   80 |             addedge(dinspre[step - 1][i + (1 << step - 1)], dinspre[step][i]);
      |                                                 ~~~~~^~~
# Verdict Execution time Memory Grader output
1 Correct 7 ms 12116 KB Output is correct
2 Correct 6 ms 12064 KB Output is correct
3 Correct 9 ms 12060 KB Output is correct
4 Correct 59 ms 12572 KB Output is correct
5 Correct 124 ms 12944 KB Output is correct
6 Correct 12 ms 12464 KB Output is correct
7 Correct 12 ms 12500 KB Output is correct
8 Correct 13 ms 12456 KB Output is correct
9 Correct 318 ms 21776 KB Output is correct
10 Correct 569 ms 251128 KB Output is correct
11 Correct 26 ms 12244 KB Output is correct
12 Correct 153 ms 13212 KB Output is correct
13 Correct 606 ms 305528 KB Output is correct
14 Correct 659 ms 305520 KB Output is correct
15 Correct 1230 ms 304932 KB Output is correct
16 Correct 1553 ms 338600 KB Output is correct
17 Correct 587 ms 258668 KB Output is correct
18 Correct 601 ms 266240 KB Output is correct
19 Correct 613 ms 258788 KB Output is correct
20 Correct 519 ms 258688 KB Output is correct
21 Correct 792 ms 295836 KB Output is correct
22 Correct 580 ms 260544 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 12064 KB Output is correct
2 Correct 8 ms 12116 KB Output is correct
3 Correct 17 ms 12500 KB Output is correct
4 Correct 15 ms 12372 KB Output is correct
5 Correct 14 ms 12456 KB Output is correct
6 Correct 18 ms 12464 KB Output is correct
7 Correct 12 ms 12464 KB Output is correct
8 Correct 12 ms 12496 KB Output is correct
9 Correct 12 ms 12372 KB Output is correct
10 Correct 12 ms 12372 KB Output is correct
11 Correct 12 ms 12460 KB Output is correct
12 Correct 10 ms 12356 KB Output is correct
13 Correct 10 ms 12372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 12064 KB Output is correct
2 Correct 8 ms 12116 KB Output is correct
3 Correct 17 ms 12500 KB Output is correct
4 Correct 15 ms 12372 KB Output is correct
5 Correct 14 ms 12456 KB Output is correct
6 Correct 18 ms 12464 KB Output is correct
7 Correct 12 ms 12464 KB Output is correct
8 Correct 12 ms 12496 KB Output is correct
9 Correct 12 ms 12372 KB Output is correct
10 Correct 12 ms 12372 KB Output is correct
11 Correct 12 ms 12460 KB Output is correct
12 Correct 10 ms 12356 KB Output is correct
13 Correct 10 ms 12372 KB Output is correct
14 Correct 8 ms 12188 KB Output is correct
15 Correct 8 ms 12116 KB Output is correct
16 Correct 13 ms 12456 KB Output is correct
17 Correct 12 ms 12500 KB Output is correct
18 Correct 12 ms 12372 KB Output is correct
19 Correct 7 ms 12136 KB Output is correct
20 Correct 13 ms 12460 KB Output is correct
21 Correct 13 ms 12464 KB Output is correct
22 Correct 13 ms 12472 KB Output is correct
23 Correct 8 ms 12192 KB Output is correct
24 Correct 8 ms 12320 KB Output is correct
25 Correct 14 ms 12416 KB Output is correct
26 Correct 10 ms 12372 KB Output is correct
27 Correct 13 ms 12456 KB Output is correct
28 Correct 8 ms 12200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 12064 KB Output is correct
2 Correct 8 ms 12116 KB Output is correct
3 Correct 17 ms 12500 KB Output is correct
4 Correct 15 ms 12372 KB Output is correct
5 Correct 14 ms 12456 KB Output is correct
6 Correct 18 ms 12464 KB Output is correct
7 Correct 12 ms 12464 KB Output is correct
8 Correct 12 ms 12496 KB Output is correct
9 Correct 12 ms 12372 KB Output is correct
10 Correct 12 ms 12372 KB Output is correct
11 Correct 12 ms 12460 KB Output is correct
12 Correct 10 ms 12356 KB Output is correct
13 Correct 10 ms 12372 KB Output is correct
14 Correct 8 ms 12188 KB Output is correct
15 Correct 8 ms 12116 KB Output is correct
16 Correct 13 ms 12456 KB Output is correct
17 Correct 12 ms 12500 KB Output is correct
18 Correct 12 ms 12372 KB Output is correct
19 Correct 7 ms 12136 KB Output is correct
20 Correct 13 ms 12460 KB Output is correct
21 Correct 13 ms 12464 KB Output is correct
22 Correct 13 ms 12472 KB Output is correct
23 Correct 8 ms 12192 KB Output is correct
24 Correct 8 ms 12320 KB Output is correct
25 Correct 14 ms 12416 KB Output is correct
26 Correct 10 ms 12372 KB Output is correct
27 Correct 13 ms 12456 KB Output is correct
28 Correct 8 ms 12200 KB Output is correct
29 Correct 14 ms 12460 KB Output is correct
30 Correct 13 ms 12516 KB Output is correct
31 Correct 13 ms 12456 KB Output is correct
32 Correct 13 ms 12500 KB Output is correct
33 Correct 15 ms 12500 KB Output is correct
34 Correct 13 ms 12372 KB Output is correct
35 Correct 13 ms 12372 KB Output is correct
36 Correct 13 ms 12416 KB Output is correct
37 Correct 12 ms 12456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 12064 KB Output is correct
2 Correct 8 ms 12116 KB Output is correct
3 Correct 17 ms 12500 KB Output is correct
4 Correct 15 ms 12372 KB Output is correct
5 Correct 14 ms 12456 KB Output is correct
6 Correct 18 ms 12464 KB Output is correct
7 Correct 12 ms 12464 KB Output is correct
8 Correct 12 ms 12496 KB Output is correct
9 Correct 12 ms 12372 KB Output is correct
10 Correct 12 ms 12372 KB Output is correct
11 Correct 12 ms 12460 KB Output is correct
12 Correct 10 ms 12356 KB Output is correct
13 Correct 10 ms 12372 KB Output is correct
14 Correct 8 ms 12188 KB Output is correct
15 Correct 8 ms 12116 KB Output is correct
16 Correct 13 ms 12456 KB Output is correct
17 Correct 12 ms 12500 KB Output is correct
18 Correct 12 ms 12372 KB Output is correct
19 Correct 7 ms 12136 KB Output is correct
20 Correct 13 ms 12460 KB Output is correct
21 Correct 13 ms 12464 KB Output is correct
22 Correct 13 ms 12472 KB Output is correct
23 Correct 8 ms 12192 KB Output is correct
24 Correct 8 ms 12320 KB Output is correct
25 Correct 14 ms 12416 KB Output is correct
26 Correct 10 ms 12372 KB Output is correct
27 Correct 13 ms 12456 KB Output is correct
28 Correct 8 ms 12200 KB Output is correct
29 Correct 14 ms 12460 KB Output is correct
30 Correct 13 ms 12516 KB Output is correct
31 Correct 13 ms 12456 KB Output is correct
32 Correct 13 ms 12500 KB Output is correct
33 Correct 15 ms 12500 KB Output is correct
34 Correct 13 ms 12372 KB Output is correct
35 Correct 13 ms 12372 KB Output is correct
36 Correct 13 ms 12416 KB Output is correct
37 Correct 12 ms 12456 KB Output is correct
38 Correct 341 ms 21176 KB Output is correct
39 Correct 579 ms 250884 KB Output is correct
40 Correct 315 ms 21964 KB Output is correct
41 Correct 337 ms 21968 KB Output is correct
42 Correct 303 ms 22236 KB Output is correct
43 Correct 272 ms 22024 KB Output is correct
44 Correct 57 ms 13720 KB Output is correct
45 Correct 506 ms 242816 KB Output is correct
46 Correct 587 ms 242860 KB Output is correct
47 Correct 557 ms 247424 KB Output is correct
48 Correct 580 ms 247588 KB Output is correct
49 Correct 505 ms 243160 KB Output is correct
50 Correct 550 ms 242952 KB Output is correct
51 Correct 535 ms 244312 KB Output is correct
52 Correct 463 ms 244456 KB Output is correct
53 Correct 78 ms 24336 KB Output is correct
54 Correct 560 ms 242812 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 12116 KB Output is correct
2 Correct 7 ms 12116 KB Output is correct
3 Correct 6 ms 12116 KB Output is correct
4 Correct 6 ms 12136 KB Output is correct
5 Correct 26 ms 12116 KB Output is correct
6 Correct 9 ms 12372 KB Output is correct
7 Correct 10 ms 12372 KB Output is correct
8 Correct 6 ms 12116 KB Output is correct
9 Correct 7 ms 12076 KB Output is correct
10 Correct 8 ms 12244 KB Output is correct
11 Correct 7 ms 12116 KB Output is correct
12 Correct 12 ms 12452 KB Output is correct
13 Correct 94 ms 12244 KB Output is correct
14 Correct 151 ms 12308 KB Output is correct
15 Correct 119 ms 12332 KB Output is correct
16 Correct 521 ms 242756 KB Output is correct
17 Correct 800 ms 257500 KB Output is correct
18 Correct 1022 ms 282940 KB Output is correct
19 Correct 664 ms 245008 KB Output is correct
20 Correct 579 ms 245348 KB Output is correct
21 Correct 702 ms 245196 KB Output is correct
22 Correct 690 ms 255724 KB Output is correct
23 Correct 646 ms 254908 KB Output is correct
24 Correct 739 ms 254944 KB Output is correct
25 Correct 650 ms 254984 KB Output is correct
26 Correct 700 ms 254980 KB Output is correct
27 Correct 770 ms 256856 KB Output is correct
28 Correct 739 ms 261152 KB Output is correct
29 Correct 713 ms 258116 KB Output is correct
30 Correct 696 ms 250532 KB Output is correct
31 Correct 626 ms 251164 KB Output is correct
32 Correct 716 ms 249616 KB Output is correct
33 Correct 675 ms 251224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 12116 KB Output is correct
2 Correct 6 ms 12064 KB Output is correct
3 Correct 9 ms 12060 KB Output is correct
4 Correct 59 ms 12572 KB Output is correct
5 Correct 124 ms 12944 KB Output is correct
6 Correct 12 ms 12464 KB Output is correct
7 Correct 12 ms 12500 KB Output is correct
8 Correct 13 ms 12456 KB Output is correct
9 Correct 318 ms 21776 KB Output is correct
10 Correct 569 ms 251128 KB Output is correct
11 Correct 26 ms 12244 KB Output is correct
12 Correct 153 ms 13212 KB Output is correct
13 Correct 606 ms 305528 KB Output is correct
14 Correct 659 ms 305520 KB Output is correct
15 Correct 1230 ms 304932 KB Output is correct
16 Correct 1553 ms 338600 KB Output is correct
17 Correct 587 ms 258668 KB Output is correct
18 Correct 601 ms 266240 KB Output is correct
19 Correct 613 ms 258788 KB Output is correct
20 Correct 519 ms 258688 KB Output is correct
21 Correct 792 ms 295836 KB Output is correct
22 Correct 580 ms 260544 KB Output is correct
23 Correct 6 ms 12064 KB Output is correct
24 Correct 8 ms 12116 KB Output is correct
25 Correct 17 ms 12500 KB Output is correct
26 Correct 15 ms 12372 KB Output is correct
27 Correct 14 ms 12456 KB Output is correct
28 Correct 18 ms 12464 KB Output is correct
29 Correct 12 ms 12464 KB Output is correct
30 Correct 12 ms 12496 KB Output is correct
31 Correct 12 ms 12372 KB Output is correct
32 Correct 12 ms 12372 KB Output is correct
33 Correct 12 ms 12460 KB Output is correct
34 Correct 10 ms 12356 KB Output is correct
35 Correct 10 ms 12372 KB Output is correct
36 Correct 8 ms 12188 KB Output is correct
37 Correct 8 ms 12116 KB Output is correct
38 Correct 13 ms 12456 KB Output is correct
39 Correct 12 ms 12500 KB Output is correct
40 Correct 12 ms 12372 KB Output is correct
41 Correct 7 ms 12136 KB Output is correct
42 Correct 13 ms 12460 KB Output is correct
43 Correct 13 ms 12464 KB Output is correct
44 Correct 13 ms 12472 KB Output is correct
45 Correct 8 ms 12192 KB Output is correct
46 Correct 8 ms 12320 KB Output is correct
47 Correct 14 ms 12416 KB Output is correct
48 Correct 10 ms 12372 KB Output is correct
49 Correct 13 ms 12456 KB Output is correct
50 Correct 8 ms 12200 KB Output is correct
51 Correct 14 ms 12460 KB Output is correct
52 Correct 13 ms 12516 KB Output is correct
53 Correct 13 ms 12456 KB Output is correct
54 Correct 13 ms 12500 KB Output is correct
55 Correct 15 ms 12500 KB Output is correct
56 Correct 13 ms 12372 KB Output is correct
57 Correct 13 ms 12372 KB Output is correct
58 Correct 13 ms 12416 KB Output is correct
59 Correct 12 ms 12456 KB Output is correct
60 Correct 341 ms 21176 KB Output is correct
61 Correct 579 ms 250884 KB Output is correct
62 Correct 315 ms 21964 KB Output is correct
63 Correct 337 ms 21968 KB Output is correct
64 Correct 303 ms 22236 KB Output is correct
65 Correct 272 ms 22024 KB Output is correct
66 Correct 57 ms 13720 KB Output is correct
67 Correct 506 ms 242816 KB Output is correct
68 Correct 587 ms 242860 KB Output is correct
69 Correct 557 ms 247424 KB Output is correct
70 Correct 580 ms 247588 KB Output is correct
71 Correct 505 ms 243160 KB Output is correct
72 Correct 550 ms 242952 KB Output is correct
73 Correct 535 ms 244312 KB Output is correct
74 Correct 463 ms 244456 KB Output is correct
75 Correct 78 ms 24336 KB Output is correct
76 Correct 560 ms 242812 KB Output is correct
77 Correct 7 ms 12116 KB Output is correct
78 Correct 7 ms 12116 KB Output is correct
79 Correct 6 ms 12116 KB Output is correct
80 Correct 6 ms 12136 KB Output is correct
81 Correct 26 ms 12116 KB Output is correct
82 Correct 9 ms 12372 KB Output is correct
83 Correct 10 ms 12372 KB Output is correct
84 Correct 6 ms 12116 KB Output is correct
85 Correct 7 ms 12076 KB Output is correct
86 Correct 8 ms 12244 KB Output is correct
87 Correct 7 ms 12116 KB Output is correct
88 Correct 12 ms 12452 KB Output is correct
89 Correct 94 ms 12244 KB Output is correct
90 Correct 151 ms 12308 KB Output is correct
91 Correct 119 ms 12332 KB Output is correct
92 Correct 521 ms 242756 KB Output is correct
93 Correct 800 ms 257500 KB Output is correct
94 Correct 1022 ms 282940 KB Output is correct
95 Correct 664 ms 245008 KB Output is correct
96 Correct 579 ms 245348 KB Output is correct
97 Correct 702 ms 245196 KB Output is correct
98 Correct 690 ms 255724 KB Output is correct
99 Correct 646 ms 254908 KB Output is correct
100 Correct 739 ms 254944 KB Output is correct
101 Correct 650 ms 254984 KB Output is correct
102 Correct 700 ms 254980 KB Output is correct
103 Correct 770 ms 256856 KB Output is correct
104 Correct 739 ms 261152 KB Output is correct
105 Correct 713 ms 258116 KB Output is correct
106 Correct 696 ms 250532 KB Output is correct
107 Correct 626 ms 251164 KB Output is correct
108 Correct 716 ms 249616 KB Output is correct
109 Correct 675 ms 251224 KB Output is correct
110 Correct 164 ms 13312 KB Output is correct
111 Correct 102 ms 12984 KB Output is correct
112 Correct 1027 ms 281292 KB Output is correct
113 Correct 732 ms 249892 KB Output is correct
114 Correct 1030 ms 277012 KB Output is correct
115 Correct 565 ms 243424 KB Output is correct
116 Correct 717 ms 251100 KB Output is correct
117 Correct 1360 ms 303588 KB Output is correct
118 Correct 622 ms 242844 KB Output is correct
119 Correct 591 ms 242756 KB Output is correct
120 Correct 52 ms 27864 KB Output is correct
121 Correct 762 ms 252396 KB Output is correct
122 Correct 778 ms 252332 KB Output is correct
123 Correct 787 ms 288880 KB Output is correct
124 Correct 768 ms 288828 KB Output is correct
125 Correct 760 ms 322416 KB Output is correct
126 Correct 1440 ms 322516 KB Output is correct
127 Correct 907 ms 277764 KB Output is correct
128 Correct 815 ms 274400 KB Output is correct
129 Correct 720 ms 254336 KB Output is correct
130 Correct 724 ms 256368 KB Output is correct