답안 #969917

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
969917 2024-04-25T20:20:22 Z efedmrlr Tourism (JOI23_tourism) C++17
100 / 100
1132 ms 64432 KB
// #pragma GCC optimize("O3,Ofast,unroll-loops")
// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>

using namespace std;


#define lli long long int
#define MP make_pair
#define pb push_back
#define REP(i,n) for(int i = 0; (i) < (n); (i)++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()


void fastio() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}


const double EPS = 0.00001;
const int INF = 1e9+500;
const int N = 1e5+5;
const int ALPH = 26;
const int LGN = 20;
constexpr int MOD = 1e9+7;
array<int, 2 * N> lg2;
struct RMQ {
    array<vector<array<int, 2> >, LGN> st;
    void reset(vector<int> &x, vector<int> &y) {
        REP(i, LGN) st[i].assign(x.size(), {INF, INF});
        for(int i = 0; i < x.size(); i++) {
            st[0][i] = {y[x[i]], x[i]};
        }
        for(int k = 1; k < LGN; k++) {
            for(int i = 0; i < x.size(); i++) {
                if(i + (1 << (k - 1)) >= x.size()) break;
                st[k][i] = min(st[k - 1][i], st[k - 1][i + (1 << (k - 1))]);
            }
        }
    }
    int query(int l, int r) {
        int k = lg2[r - l + 1];
        return min(st[k][l], st[k][r - (1 << k) + 1])[1];
    }
};

struct LCA {
    vector<int> tin, eul, dep;
    RMQ rm;
    int tim = 0;
    LCA() {
        tim = 0;
        eul.clear();
        tin.assign(N, 0);
        dep.assign(N, 0);
    }
    void prec(int node, int par, vector<vector<int> > &adj) {
        tin[node] = tim++;
        eul.pb(node);
        for(auto c : adj[node]) {
            if(c == par) continue;
            dep[c] = dep[node] + 1;
            prec(c, node, adj);
            eul.pb(node); tim++;
        }
    }
    void build() {
        rm.reset(eul, dep);
    }
    int query(int a, int b) {
        if(tin[a] > tin[b]) swap(a, b);
        return rm.query(tin[a], tin[b]);
    }

};

struct BIT {
    vector<int> st;
    int n;
    void reset(int sz) {
        n = sz;
        st.assign(sz + 3, 0);
    }
    void update(int ind, int val) {
        ind++;
        while(ind <= n) {
            st[ind] += val;
            ind += (ind) & (-ind);
        }
    }
    int getSum(int ind) {
        int ret = 0;
        ind++;
        while(ind > 0) {
            ret += st[ind];
            ind -= ind & (-ind);
        }
        return ret;
    }
};

int n,m,q;

vector<int> a(N, 0);
vector<vector<int> > occ(N, vector<int>());
vector<vector<int> > adj(N, vector<int>()), adj2(N, vector<int>());
LCA lca;
vector<int> res(N, 0);

void dfs(int node, int par, vector<array<int, 3> > &eg, int tm) {
    array<int, 3> ed = {0, INF, 0}; // x, y, w
    if(node != par) {
        ed[2] = abs(lca.dep[node] - lca.dep[par]);
    }
    for(auto c : adj2[node]) {
        if(c == par) continue;
        dfs(c, node, eg, tm);
        ed[0] = max(ed[0], eg.back()[0]);
        ed[1] = min(ed[1], eg.back()[1]);
    }
    auto itr = lower_bound(all(occ[node]), tm);
    if(itr != occ[node].end())ed[1] = min(ed[1], *itr);
    itr = lower_bound(all(occ[node]), tm);
    if(itr != occ[node].begin()) {
        itr--;
        ed[0] = max(ed[0], *itr);
    }
    if(node != par) eg.pb(ed);
}

void dnc(int tl, int tr, vector<array<int, 3> > &qu) {
    // cout << "tl:" << tl << " tr:" << tr << endl;
    if(tl > tr || qu.empty()) return;
    if(tl == tr) {
        return;
    }
    int tm = (tl + tr) >> 1;
    vector<array<int, 3> > cur, lf, rg;
    for(auto &c : qu) {
        if(c[0] > tm) {
            rg.pb(c);
        }
        else if(c[1] < tm) {
            lf.pb(c);
        }
        else {
            cur.pb(c);
        }
    }
    dnc(1, tm - 1, lf); dnc(tm + 1, tr, rg);
    if(cur.empty()) return;
    // cout << "tl:" << tl << " tr:" << tr << endl;
    vector<array<int, 3> > eg;
    // Virt Tree
    vector<int> vtr;
    for(int i = tl; i <= tr; i++) {
        vtr.pb(a[i]);
    }
    sort(all(vtr), [](int u, int v) {
        return lca.tin[u] < lca.tin[v];
    });
    vtr.resize(unique(all(vtr)) - vtr.begin());
    int sz = vtr.size();
    for(int i = 1; i < sz; i++) {
        vtr.pb(lca.query(vtr[i - 1], vtr[i]));
    }
    sort(all(vtr), [](int u, int v) {
        return lca.tin[u] < lca.tin[v];
    });
    vtr.resize(unique(all(vtr)) - vtr.begin());
    vector<int> stck;
    // assert(!vtr.empty());
    int rt = a[tm];
    
    stck.pb(vtr[0]);
    sz = vtr.size();
    for(auto c : vtr) {
        adj2[c].clear();
    }
    for(int i = 1; i < sz; i++) {
        while(lca.query(vtr[i], stck.back()) != stck.back()) {
            stck.pop_back();
        }
        adj2[stck.back()].pb(vtr[i]);
        adj2[vtr[i]].pb(stck.back());
        stck.pb(vtr[i]);
    }
    // for(auto c : vtr) {
    //     cout << c << " ";
    // }
    // cout << endl;
    dfs(rt, rt, eg, tm);
    for(auto &c : eg) {
        // assert(c[0] < tm && c[1] > tm);
        c[1] = min(c[1], tr + 1);
    }
    // take l <= x
    sort(rall(eg));
    sort(rall(cur));
    int ind = 0, sum = 0;
    for(auto &c : cur) {
        while(ind < eg.size() && eg[ind][0] >= c[0]) {
            sum += eg[ind][2];
            ind++;
        }
        res[c[2]] += sum;
    }

    // take l > x && r >= y
    reverse(all(eg));
    reverse(all(cur));
    BIT st;
    st.reset(tr - tm + 2);
    ind = 0;
    for(auto &c : cur) {
        while(ind < eg.size() && eg[ind][0] < c[0]) {
            st.update(eg[ind][1] - tm, eg[ind][2]);
            ind++;
        }
        res[c[2]] += st.getSum(c[1] - tm);
    }
}

inline void solve() {
    cin >> n >> m >> q;
    REP(i, n - 1) {
        int u, v;
        cin >> u >> v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    lca.prec(1, 0, adj);
    lca.build();
    for(int i = 1; i <= m; i++) {
        cin >> a[i];
        occ[a[i]].pb(i);
    }
    vector<array<int, 3> > qu(q);
    for(int i = 0; i < q; i++) {
        cin >> qu[i][0] >> qu[i][1];
        qu[i][2] = i;
    }

    dnc(1, m, qu);
    REP(i, q) {
        cout << res[i] + 1 << "\n";
    }

}
 
signed main() {
    lg2[1] = 0;
    for(int i = 2; i < 2 * N; i++) {
        lg2[i] = lg2[i >> 1] + 1;
    }
    fastio();
    int test = 1;
    //cin>>test;
    while(test--) {
        solve();
    }
    
}

Compilation message

tourism.cpp: In member function 'void RMQ::reset(std::vector<int>&, std::vector<int>&)':
tourism.cpp:33:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |         for(int i = 0; i < x.size(); i++) {
      |                        ~~^~~~~~~~~~
tourism.cpp:37:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |             for(int i = 0; i < x.size(); i++) {
      |                            ~~^~~~~~~~~~
tourism.cpp:38:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |                 if(i + (1 << (k - 1)) >= x.size()) break;
      |                    ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
tourism.cpp: In function 'void dnc(int, int, std::vector<std::array<int, 3> >&)':
tourism.cpp:204:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<int, 3> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  204 |         while(ind < eg.size() && eg[ind][0] >= c[0]) {
      |               ~~~~^~~~~~~~~~~
tourism.cpp:218:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<int, 3> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  218 |         while(ind < eg.size() && eg[ind][0] < c[0]) {
      |               ~~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 9820 KB Output is correct
2 Correct 4 ms 9820 KB Output is correct
3 Correct 5 ms 9820 KB Output is correct
4 Correct 5 ms 9816 KB Output is correct
5 Correct 5 ms 9816 KB Output is correct
6 Correct 5 ms 9820 KB Output is correct
7 Correct 5 ms 9820 KB Output is correct
8 Correct 6 ms 9920 KB Output is correct
9 Correct 5 ms 9888 KB Output is correct
10 Correct 5 ms 9820 KB Output is correct
11 Correct 6 ms 9820 KB Output is correct
12 Correct 5 ms 9816 KB Output is correct
13 Correct 6 ms 9820 KB Output is correct
14 Correct 5 ms 9820 KB Output is correct
15 Correct 5 ms 9820 KB Output is correct
16 Correct 5 ms 9820 KB Output is correct
17 Correct 5 ms 9820 KB Output is correct
18 Correct 6 ms 9820 KB Output is correct
19 Correct 5 ms 9876 KB Output is correct
20 Correct 5 ms 9816 KB Output is correct
21 Correct 5 ms 9820 KB Output is correct
22 Correct 7 ms 9816 KB Output is correct
23 Correct 5 ms 9816 KB Output is correct
24 Correct 5 ms 9820 KB Output is correct
25 Correct 5 ms 9820 KB Output is correct
26 Correct 5 ms 9820 KB Output is correct
27 Correct 5 ms 9820 KB Output is correct
28 Correct 5 ms 9944 KB Output is correct
29 Correct 5 ms 9820 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 9820 KB Output is correct
2 Correct 4 ms 9820 KB Output is correct
3 Correct 5 ms 9820 KB Output is correct
4 Correct 5 ms 9816 KB Output is correct
5 Correct 5 ms 9816 KB Output is correct
6 Correct 5 ms 9820 KB Output is correct
7 Correct 5 ms 9820 KB Output is correct
8 Correct 6 ms 9920 KB Output is correct
9 Correct 5 ms 9888 KB Output is correct
10 Correct 5 ms 9820 KB Output is correct
11 Correct 6 ms 9820 KB Output is correct
12 Correct 5 ms 9816 KB Output is correct
13 Correct 6 ms 9820 KB Output is correct
14 Correct 5 ms 9820 KB Output is correct
15 Correct 5 ms 9820 KB Output is correct
16 Correct 5 ms 9820 KB Output is correct
17 Correct 5 ms 9820 KB Output is correct
18 Correct 6 ms 9820 KB Output is correct
19 Correct 5 ms 9876 KB Output is correct
20 Correct 5 ms 9816 KB Output is correct
21 Correct 5 ms 9820 KB Output is correct
22 Correct 7 ms 9816 KB Output is correct
23 Correct 5 ms 9816 KB Output is correct
24 Correct 5 ms 9820 KB Output is correct
25 Correct 5 ms 9820 KB Output is correct
26 Correct 5 ms 9820 KB Output is correct
27 Correct 5 ms 9820 KB Output is correct
28 Correct 5 ms 9944 KB Output is correct
29 Correct 5 ms 9820 KB Output is correct
30 Correct 9 ms 10588 KB Output is correct
31 Correct 10 ms 10584 KB Output is correct
32 Correct 10 ms 10844 KB Output is correct
33 Correct 12 ms 10632 KB Output is correct
34 Correct 11 ms 10844 KB Output is correct
35 Correct 7 ms 10584 KB Output is correct
36 Correct 7 ms 10584 KB Output is correct
37 Correct 8 ms 10588 KB Output is correct
38 Correct 10 ms 10840 KB Output is correct
39 Correct 10 ms 10840 KB Output is correct
40 Correct 10 ms 10844 KB Output is correct
41 Correct 6 ms 10940 KB Output is correct
42 Correct 7 ms 10844 KB Output is correct
43 Correct 8 ms 10904 KB Output is correct
44 Correct 10 ms 10844 KB Output is correct
45 Correct 10 ms 10840 KB Output is correct
46 Correct 10 ms 10844 KB Output is correct
47 Correct 6 ms 10840 KB Output is correct
48 Correct 6 ms 10844 KB Output is correct
49 Correct 7 ms 10844 KB Output is correct
50 Correct 11 ms 11100 KB Output is correct
51 Correct 9 ms 10820 KB Output is correct
52 Correct 9 ms 10844 KB Output is correct
53 Correct 8 ms 10756 KB Output is correct
54 Correct 9 ms 10844 KB Output is correct
55 Correct 9 ms 10844 KB Output is correct
56 Correct 6 ms 9924 KB Output is correct
57 Correct 6 ms 10588 KB Output is correct
58 Correct 12 ms 10844 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 9816 KB Output is correct
2 Correct 5 ms 9820 KB Output is correct
3 Correct 5 ms 9808 KB Output is correct
4 Correct 378 ms 41076 KB Output is correct
5 Correct 255 ms 49704 KB Output is correct
6 Correct 363 ms 57184 KB Output is correct
7 Correct 455 ms 61008 KB Output is correct
8 Correct 452 ms 62912 KB Output is correct
9 Correct 472 ms 63228 KB Output is correct
10 Correct 498 ms 62272 KB Output is correct
11 Correct 484 ms 61444 KB Output is correct
12 Correct 118 ms 59844 KB Output is correct
13 Correct 117 ms 59836 KB Output is correct
14 Correct 131 ms 59844 KB Output is correct
15 Correct 58 ms 51656 KB Output is correct
16 Correct 585 ms 64432 KB Output is correct
17 Correct 49 ms 15180 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 9820 KB Output is correct
2 Correct 345 ms 34000 KB Output is correct
3 Correct 540 ms 36920 KB Output is correct
4 Correct 480 ms 39912 KB Output is correct
5 Correct 111 ms 53964 KB Output is correct
6 Correct 156 ms 54140 KB Output is correct
7 Correct 244 ms 54040 KB Output is correct
8 Correct 406 ms 54148 KB Output is correct
9 Correct 474 ms 54100 KB Output is correct
10 Correct 557 ms 54168 KB Output is correct
11 Correct 694 ms 54364 KB Output is correct
12 Correct 828 ms 54432 KB Output is correct
13 Correct 886 ms 54620 KB Output is correct
14 Correct 1033 ms 55716 KB Output is correct
15 Correct 1132 ms 59064 KB Output is correct
16 Correct 597 ms 54920 KB Output is correct
17 Correct 587 ms 54804 KB Output is correct
18 Correct 596 ms 54604 KB Output is correct
19 Correct 102 ms 52936 KB Output is correct
20 Correct 130 ms 52980 KB Output is correct
21 Correct 159 ms 52992 KB Output is correct
22 Correct 204 ms 52852 KB Output is correct
23 Correct 277 ms 53272 KB Output is correct
24 Correct 321 ms 53008 KB Output is correct
25 Correct 391 ms 52968 KB Output is correct
26 Correct 451 ms 52984 KB Output is correct
27 Correct 548 ms 53040 KB Output is correct
28 Correct 602 ms 53144 KB Output is correct
29 Correct 669 ms 52940 KB Output is correct
30 Correct 757 ms 53196 KB Output is correct
31 Correct 815 ms 53972 KB Output is correct
32 Correct 903 ms 54212 KB Output is correct
33 Correct 997 ms 55744 KB Output is correct
34 Correct 1049 ms 58460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 9820 KB Output is correct
2 Correct 5 ms 9820 KB Output is correct
3 Correct 5 ms 9820 KB Output is correct
4 Correct 523 ms 39408 KB Output is correct
5 Correct 530 ms 40264 KB Output is correct
6 Correct 640 ms 52224 KB Output is correct
7 Correct 696 ms 57952 KB Output is correct
8 Correct 703 ms 58184 KB Output is correct
9 Correct 755 ms 58092 KB Output is correct
10 Correct 705 ms 58096 KB Output is correct
11 Correct 688 ms 58104 KB Output is correct
12 Correct 681 ms 58168 KB Output is correct
13 Correct 689 ms 58012 KB Output is correct
14 Correct 52 ms 15344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 9820 KB Output is correct
2 Correct 4 ms 9820 KB Output is correct
3 Correct 5 ms 9820 KB Output is correct
4 Correct 5 ms 9816 KB Output is correct
5 Correct 5 ms 9816 KB Output is correct
6 Correct 5 ms 9820 KB Output is correct
7 Correct 5 ms 9820 KB Output is correct
8 Correct 6 ms 9920 KB Output is correct
9 Correct 5 ms 9888 KB Output is correct
10 Correct 5 ms 9820 KB Output is correct
11 Correct 6 ms 9820 KB Output is correct
12 Correct 5 ms 9816 KB Output is correct
13 Correct 6 ms 9820 KB Output is correct
14 Correct 5 ms 9820 KB Output is correct
15 Correct 5 ms 9820 KB Output is correct
16 Correct 5 ms 9820 KB Output is correct
17 Correct 5 ms 9820 KB Output is correct
18 Correct 6 ms 9820 KB Output is correct
19 Correct 5 ms 9876 KB Output is correct
20 Correct 5 ms 9816 KB Output is correct
21 Correct 5 ms 9820 KB Output is correct
22 Correct 7 ms 9816 KB Output is correct
23 Correct 5 ms 9816 KB Output is correct
24 Correct 5 ms 9820 KB Output is correct
25 Correct 5 ms 9820 KB Output is correct
26 Correct 5 ms 9820 KB Output is correct
27 Correct 5 ms 9820 KB Output is correct
28 Correct 5 ms 9944 KB Output is correct
29 Correct 5 ms 9820 KB Output is correct
30 Correct 9 ms 10588 KB Output is correct
31 Correct 10 ms 10584 KB Output is correct
32 Correct 10 ms 10844 KB Output is correct
33 Correct 12 ms 10632 KB Output is correct
34 Correct 11 ms 10844 KB Output is correct
35 Correct 7 ms 10584 KB Output is correct
36 Correct 7 ms 10584 KB Output is correct
37 Correct 8 ms 10588 KB Output is correct
38 Correct 10 ms 10840 KB Output is correct
39 Correct 10 ms 10840 KB Output is correct
40 Correct 10 ms 10844 KB Output is correct
41 Correct 6 ms 10940 KB Output is correct
42 Correct 7 ms 10844 KB Output is correct
43 Correct 8 ms 10904 KB Output is correct
44 Correct 10 ms 10844 KB Output is correct
45 Correct 10 ms 10840 KB Output is correct
46 Correct 10 ms 10844 KB Output is correct
47 Correct 6 ms 10840 KB Output is correct
48 Correct 6 ms 10844 KB Output is correct
49 Correct 7 ms 10844 KB Output is correct
50 Correct 11 ms 11100 KB Output is correct
51 Correct 9 ms 10820 KB Output is correct
52 Correct 9 ms 10844 KB Output is correct
53 Correct 8 ms 10756 KB Output is correct
54 Correct 9 ms 10844 KB Output is correct
55 Correct 9 ms 10844 KB Output is correct
56 Correct 6 ms 9924 KB Output is correct
57 Correct 6 ms 10588 KB Output is correct
58 Correct 12 ms 10844 KB Output is correct
59 Correct 5 ms 9816 KB Output is correct
60 Correct 5 ms 9820 KB Output is correct
61 Correct 5 ms 9808 KB Output is correct
62 Correct 378 ms 41076 KB Output is correct
63 Correct 255 ms 49704 KB Output is correct
64 Correct 363 ms 57184 KB Output is correct
65 Correct 455 ms 61008 KB Output is correct
66 Correct 452 ms 62912 KB Output is correct
67 Correct 472 ms 63228 KB Output is correct
68 Correct 498 ms 62272 KB Output is correct
69 Correct 484 ms 61444 KB Output is correct
70 Correct 118 ms 59844 KB Output is correct
71 Correct 117 ms 59836 KB Output is correct
72 Correct 131 ms 59844 KB Output is correct
73 Correct 58 ms 51656 KB Output is correct
74 Correct 585 ms 64432 KB Output is correct
75 Correct 49 ms 15180 KB Output is correct
76 Correct 5 ms 9820 KB Output is correct
77 Correct 345 ms 34000 KB Output is correct
78 Correct 540 ms 36920 KB Output is correct
79 Correct 480 ms 39912 KB Output is correct
80 Correct 111 ms 53964 KB Output is correct
81 Correct 156 ms 54140 KB Output is correct
82 Correct 244 ms 54040 KB Output is correct
83 Correct 406 ms 54148 KB Output is correct
84 Correct 474 ms 54100 KB Output is correct
85 Correct 557 ms 54168 KB Output is correct
86 Correct 694 ms 54364 KB Output is correct
87 Correct 828 ms 54432 KB Output is correct
88 Correct 886 ms 54620 KB Output is correct
89 Correct 1033 ms 55716 KB Output is correct
90 Correct 1132 ms 59064 KB Output is correct
91 Correct 597 ms 54920 KB Output is correct
92 Correct 587 ms 54804 KB Output is correct
93 Correct 596 ms 54604 KB Output is correct
94 Correct 102 ms 52936 KB Output is correct
95 Correct 130 ms 52980 KB Output is correct
96 Correct 159 ms 52992 KB Output is correct
97 Correct 204 ms 52852 KB Output is correct
98 Correct 277 ms 53272 KB Output is correct
99 Correct 321 ms 53008 KB Output is correct
100 Correct 391 ms 52968 KB Output is correct
101 Correct 451 ms 52984 KB Output is correct
102 Correct 548 ms 53040 KB Output is correct
103 Correct 602 ms 53144 KB Output is correct
104 Correct 669 ms 52940 KB Output is correct
105 Correct 757 ms 53196 KB Output is correct
106 Correct 815 ms 53972 KB Output is correct
107 Correct 903 ms 54212 KB Output is correct
108 Correct 997 ms 55744 KB Output is correct
109 Correct 1049 ms 58460 KB Output is correct
110 Correct 5 ms 9820 KB Output is correct
111 Correct 5 ms 9820 KB Output is correct
112 Correct 5 ms 9820 KB Output is correct
113 Correct 523 ms 39408 KB Output is correct
114 Correct 530 ms 40264 KB Output is correct
115 Correct 640 ms 52224 KB Output is correct
116 Correct 696 ms 57952 KB Output is correct
117 Correct 703 ms 58184 KB Output is correct
118 Correct 755 ms 58092 KB Output is correct
119 Correct 705 ms 58096 KB Output is correct
120 Correct 688 ms 58104 KB Output is correct
121 Correct 681 ms 58168 KB Output is correct
122 Correct 689 ms 58012 KB Output is correct
123 Correct 52 ms 15344 KB Output is correct
124 Correct 580 ms 56828 KB Output is correct
125 Correct 452 ms 52876 KB Output is correct
126 Correct 702 ms 57896 KB Output is correct
127 Correct 717 ms 58172 KB Output is correct
128 Correct 710 ms 58092 KB Output is correct
129 Correct 692 ms 58148 KB Output is correct
130 Correct 684 ms 58244 KB Output is correct
131 Correct 501 ms 61112 KB Output is correct
132 Correct 551 ms 60456 KB Output is correct
133 Correct 519 ms 63420 KB Output is correct
134 Correct 575 ms 56820 KB Output is correct
135 Correct 580 ms 56964 KB Output is correct
136 Correct 626 ms 57064 KB Output is correct
137 Correct 419 ms 57508 KB Output is correct
138 Correct 405 ms 57444 KB Output is correct
139 Correct 448 ms 57452 KB Output is correct
140 Correct 413 ms 57316 KB Output is correct
141 Correct 436 ms 57296 KB Output is correct
142 Correct 435 ms 57544 KB Output is correct
143 Correct 66 ms 48076 KB Output is correct
144 Correct 780 ms 58856 KB Output is correct