답안 #1108047

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1108047 2024-11-02T15:56:58 Z mispertion 새 집 (APIO18_new_home) C++17
100 / 100
4878 ms 620624 KB
#include<bits/stdc++.h>

using namespace std;
#pragma GCC optimize("O1")

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
#define F first
#define S second

const ld PI = 3.1415926535;
const int N = 5e5 + 2;
const int M = 1e7 + 1;
int mod = 998244353;
const int infi = INT_MAX;
const ll infl = LLONG_MAX;

int mult(int a, int b) {
    return a * 1LL * b % mod;
}

int sum(int a, int b) {
    if (a + b < 0)
        return a + b + mod;
    if (a + b >= mod)
        return a + b - mod;
    return a + b;
}


ll binpow(ll a, ll n) {
    if (n == 0)
        return 1;
    if (n % 2 == 1) {
        return binpow(a, n - 1) * a % mod;
    } else {
        ll b = binpow(a, n / 2);
        return b * b % mod;
    }
}

struct segtree{
    int t[M], l[M], r[M];
    int cur = 0;

    segtree(){
        t[0] = -infi;
        l[0] = -1;
        r[0] = -1;
    }

    void add(int v, int tl, int tr, int i, int x){
        if(tl == tr){
            t[v] = max(t[v], x);
            //cout << v << ' ' << l[v] << ' ' << r[v] << ' ' << tl << ' ' << tr << ' ' << t[v] << '\n';
            return;
        }
        int tm = (tl + tr) / 2;
        if(i <= tm){
            if(l[v] == -1){
                l[v] = ++cur;
                t[cur] = -infi;
                l[cur] = -1;
                r[cur] = -1;
            }
            add(l[v], tl, tm, i, x);
        }else{
            if(r[v] == -1){
                r[v] = ++cur;
                t[cur] = -infi;
                l[cur] = -1;
                r[cur] = -1;
            }
            add(r[v], tm + 1, tr, i, x);
        }
        t[v] = -infi;
        if(l[v] != -1)
            t[v] = max(t[v], t[l[v]]);
        if(r[v] != -1)
            t[v] = max(t[v], t[r[v]]);
        //cout << v << ' ' << l[v] << ' ' << r[v] << ' ' << tl << ' ' << tr << ' ' << t[v] << '\n';
    }

    void sett(int v, int tl, int tr, int i, int x){
        if(tl == tr){
            t[v] = x;
            //cout << v << ' ' << l[v] << ' ' << r[v] << ' ' << tl << ' ' << tr << ' ' << t[v] << '\n';
            return;
        }
        int tm = (tl + tr) / 2;
        if(i <= tm){
            if(l[v] == -1){
                l[v] = ++cur;
                t[cur] = -infi;
                l[cur] = -1;
                r[cur] = -1;
            }
            sett(l[v], tl, tm, i, x);
        }else{
            if(r[v] == -1){
                r[v] = ++cur;
                t[cur] = -infi;
                l[cur] = -1;
                r[cur] = -1;
            }
            sett(r[v], tm + 1, tr, i, x);
        }
        t[v] = -infi;
        if(l[v] != -1)
            t[v] = max(t[v], t[l[v]]);
        if(r[v] != -1)
            t[v] = max(t[v], t[r[v]]);
        //cout << v << ' ' << l[v] << ' ' << r[v] << ' ' << tl << ' ' << tr << ' ' << t[v] << '\n';
    }

    int get(int v, int tl, int tr, int lu, int ru){
        if(v == -1)
            return -infi;
        if(tl > ru || lu > tr)
            return -infi;
        if(lu <= tl && tr <= ru)
            return t[v];
        int tm = (tl + tr) / 2;
        return max(get(l[v], tl, tm, lu, ru), get(r[v], tm + 1, tr, lu, ru));
    }
};

int n, q, k, ans[N], L = 0, R = 2e8;
vector<pair<pii, pii>> evs;
multiset<int> cr[N];
gp_hash_table<int, multiset<int>> spl, spr;
segtree lt = segtree(), rt = segtree();

void add(int i, int x1, int x2){
    lt.add(0, L, R, i, x1);
    rt.add(0, L, R, i, x2);
    spl[i].insert(x1);
    spr[i].insert(x2);
}

void rem(int i, int x1, int x2){
    auto da = spl.find(i);
    auto ha = spr.find(i);
    auto ed = (--da->S.end());
    auto hd = (--ha->S.end());
    if(*ed == x1){
        da->S.erase(ed);
        if(da->S.size() > 0){
            lt.sett(0, L, R, i, *(--da->S.end()));
        }else{
            lt.sett(0, L, R, i, -infi);
        }
    }else{
        da->S.erase(da->S.find(x1));
    }
    if(*hd == x2){
        ha->S.erase(hd);
        if(ha->S.size() > 0)
            rt.sett(0, L, R, i, *(--ha->S.end()));
        else
            rt.sett(0, L, R, i, -infi);
    }else{
        ha->S.erase(ha->S.find(x2));
    }
}

void solve() {
    cin >> n >> k >> q;
    for(int i = 1; i <= n; i++){
        int x, tp, a, b;
        cin >> x >> tp >> a >> b;
        x *= 2;
        evs.push_back({{a, 1}, {x, tp}});
        evs.push_back({{b + 1, -1}, {x, tp}});
    }
    for(int i = 1; i <= q; i++){
        int l, y;
        cin >> l >> y;
        l *= 2;
        evs.push_back({{y, 2}, {l, i}});
    }
    sort(evs.begin(), evs.end());
    int cnt = k;
    for(auto ev : evs){
        //cout << ev.F.F << ' ' << ev.F.S << ' ' << ev.S.F << ' ' << ev.S.S << '\n';
        if(ev.F.S == 1){
            int x = ev.S.F, tp = ev.S.S;
            if(cr[tp].find(x) != cr[tp].end()){
                cr[tp].insert(x);
                continue;
            }
            if(cr[tp].size() == 0){
                cr[tp].insert(x);
                add(L, x, x - 2 * L);
                add(R, 2 * R - x, -x);
                cnt--;
                continue;
            }
            int l = -1, r = -1;
            auto it = cr[tp].upper_bound(x);
            if(it != cr[tp].end()){
                add(((*it) + x) / 2, *it, -x);
                r = *it;
            }else{
                add(R, 2 * R - x, -x);
            }
            it = cr[tp].lower_bound(x);
            if(it != cr[tp].begin()){
                it--;
                add((x + (*it)) / 2, x, -(*it));
                l = *it;
            }else{
                add(L, x, x - 2 * L);
            }
            if(l != -1 && r != -1){
                rem((r + l) / 2, r, -l);
            }
            if(r == -1 && l != -1){
                rem(R, 2 * R - l, -l);
            }
            if(r != -1 && l == -1){
                rem(L, r, r - 2 * L);
            }
            cr[tp].insert(x);
        }else if(ev.F.S == -1){
            int x = ev.S.F, tp = ev.S.S;
            int l = -1, r = -1;
            if(cr[tp].count(x) > 1){
                cr[tp].erase(cr[tp].find(x));
                continue;
            }
            auto it = cr[tp].upper_bound(x);
            if(it != cr[tp].end()){
                r = *it;
                rem((r + x) / 2, r, -x);
            }else{
                rem(R, 2 * R - x, -x);
            }
            it = cr[tp].lower_bound(x);
            if(it != cr[tp].begin()){
                it--;
                l = (*it);
                rem((x + l) / 2, x, -l);
            }else{
                rem(L, x, x - 2 * L);
            }
            cr[tp].erase(cr[tp].find(x));
            if(l == -1 && r == -1){
                cnt++;
            }else if(l == -1){
                add(L, r, r - 2 * L);
            }else if(r == -1){
                add(R, 2 * R - l, -l);
            }else{
                add((r + l) / 2, r, -l);
            }
        }else{
            int x = ev.S.F, i = ev.S.S;
            int ret = max(lt.get(0, L, R, L, x) - x, rt.get(0, L, R, x, R) + x);
            if(cnt != 0)
                ans[i] = -1;
            else
                ans[i] = (ret < 0 ? -1 : ret / 2);
        }    
        //cout << cnt << '\n';   
    }
    for(int i = 1; i <=q; i++)
        cout << ans[i] << ' ';
    cout << '\n';
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 35152 KB Output is correct
2 Correct 6 ms 35320 KB Output is correct
3 Correct 6 ms 35152 KB Output is correct
4 Correct 6 ms 35268 KB Output is correct
5 Correct 6 ms 35408 KB Output is correct
6 Correct 9 ms 35664 KB Output is correct
7 Correct 7 ms 35408 KB Output is correct
8 Correct 8 ms 35664 KB Output is correct
9 Correct 7 ms 35408 KB Output is correct
10 Correct 9 ms 35920 KB Output is correct
11 Correct 7 ms 35408 KB Output is correct
12 Correct 7 ms 35664 KB Output is correct
13 Correct 7 ms 35408 KB Output is correct
14 Correct 7 ms 35712 KB Output is correct
15 Correct 7 ms 35664 KB Output is correct
16 Correct 7 ms 35408 KB Output is correct
17 Correct 7 ms 35656 KB Output is correct
18 Correct 8 ms 35664 KB Output is correct
19 Correct 7 ms 35536 KB Output is correct
20 Correct 7 ms 35664 KB Output is correct
21 Correct 6 ms 35408 KB Output is correct
22 Correct 7 ms 35408 KB Output is correct
23 Correct 7 ms 35408 KB Output is correct
24 Correct 7 ms 35408 KB Output is correct
25 Correct 6 ms 35552 KB Output is correct
26 Correct 6 ms 35576 KB Output is correct
27 Correct 6 ms 35408 KB Output is correct
28 Correct 6 ms 35544 KB Output is correct
29 Correct 7 ms 35664 KB Output is correct
30 Correct 6 ms 35408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 35152 KB Output is correct
2 Correct 6 ms 35320 KB Output is correct
3 Correct 6 ms 35152 KB Output is correct
4 Correct 6 ms 35268 KB Output is correct
5 Correct 6 ms 35408 KB Output is correct
6 Correct 9 ms 35664 KB Output is correct
7 Correct 7 ms 35408 KB Output is correct
8 Correct 8 ms 35664 KB Output is correct
9 Correct 7 ms 35408 KB Output is correct
10 Correct 9 ms 35920 KB Output is correct
11 Correct 7 ms 35408 KB Output is correct
12 Correct 7 ms 35664 KB Output is correct
13 Correct 7 ms 35408 KB Output is correct
14 Correct 7 ms 35712 KB Output is correct
15 Correct 7 ms 35664 KB Output is correct
16 Correct 7 ms 35408 KB Output is correct
17 Correct 7 ms 35656 KB Output is correct
18 Correct 8 ms 35664 KB Output is correct
19 Correct 7 ms 35536 KB Output is correct
20 Correct 7 ms 35664 KB Output is correct
21 Correct 6 ms 35408 KB Output is correct
22 Correct 7 ms 35408 KB Output is correct
23 Correct 7 ms 35408 KB Output is correct
24 Correct 7 ms 35408 KB Output is correct
25 Correct 6 ms 35552 KB Output is correct
26 Correct 6 ms 35576 KB Output is correct
27 Correct 6 ms 35408 KB Output is correct
28 Correct 6 ms 35544 KB Output is correct
29 Correct 7 ms 35664 KB Output is correct
30 Correct 6 ms 35408 KB Output is correct
31 Correct 671 ms 168708 KB Output is correct
32 Correct 101 ms 42176 KB Output is correct
33 Correct 620 ms 166036 KB Output is correct
34 Correct 640 ms 166660 KB Output is correct
35 Correct 760 ms 169260 KB Output is correct
36 Correct 771 ms 169280 KB Output is correct
37 Correct 460 ms 162552 KB Output is correct
38 Correct 477 ms 161952 KB Output is correct
39 Correct 384 ms 162076 KB Output is correct
40 Correct 407 ms 162592 KB Output is correct
41 Correct 342 ms 102064 KB Output is correct
42 Correct 349 ms 101512 KB Output is correct
43 Correct 83 ms 42860 KB Output is correct
44 Correct 354 ms 101580 KB Output is correct
45 Correct 326 ms 103272 KB Output is correct
46 Correct 309 ms 103700 KB Output is correct
47 Correct 202 ms 74700 KB Output is correct
48 Correct 225 ms 96116 KB Output is correct
49 Correct 261 ms 99676 KB Output is correct
50 Correct 260 ms 102024 KB Output is correct
51 Correct 233 ms 101572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2538 ms 242688 KB Output is correct
2 Correct 1821 ms 341516 KB Output is correct
3 Correct 837 ms 123532 KB Output is correct
4 Correct 2326 ms 220576 KB Output is correct
5 Correct 2051 ms 343300 KB Output is correct
6 Correct 1917 ms 341292 KB Output is correct
7 Correct 824 ms 126188 KB Output is correct
8 Correct 2544 ms 232816 KB Output is correct
9 Correct 2657 ms 340092 KB Output is correct
10 Correct 2258 ms 340000 KB Output is correct
11 Correct 1852 ms 338696 KB Output is correct
12 Correct 2024 ms 347980 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4144 ms 557468 KB Output is correct
2 Correct 2243 ms 67432 KB Output is correct
3 Correct 3936 ms 569612 KB Output is correct
4 Correct 1020 ms 128936 KB Output is correct
5 Correct 3556 ms 341192 KB Output is correct
6 Correct 3296 ms 244828 KB Output is correct
7 Correct 3606 ms 569172 KB Output is correct
8 Correct 3934 ms 569588 KB Output is correct
9 Correct 977 ms 130940 KB Output is correct
10 Correct 3318 ms 341436 KB Output is correct
11 Correct 3807 ms 384620 KB Output is correct
12 Correct 4061 ms 573660 KB Output is correct
13 Correct 1947 ms 558572 KB Output is correct
14 Correct 1909 ms 561708 KB Output is correct
15 Correct 2417 ms 564508 KB Output is correct
16 Correct 2620 ms 564856 KB Output is correct
17 Correct 2299 ms 563460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 35152 KB Output is correct
2 Correct 6 ms 35320 KB Output is correct
3 Correct 6 ms 35152 KB Output is correct
4 Correct 6 ms 35268 KB Output is correct
5 Correct 6 ms 35408 KB Output is correct
6 Correct 9 ms 35664 KB Output is correct
7 Correct 7 ms 35408 KB Output is correct
8 Correct 8 ms 35664 KB Output is correct
9 Correct 7 ms 35408 KB Output is correct
10 Correct 9 ms 35920 KB Output is correct
11 Correct 7 ms 35408 KB Output is correct
12 Correct 7 ms 35664 KB Output is correct
13 Correct 7 ms 35408 KB Output is correct
14 Correct 7 ms 35712 KB Output is correct
15 Correct 7 ms 35664 KB Output is correct
16 Correct 7 ms 35408 KB Output is correct
17 Correct 7 ms 35656 KB Output is correct
18 Correct 8 ms 35664 KB Output is correct
19 Correct 7 ms 35536 KB Output is correct
20 Correct 7 ms 35664 KB Output is correct
21 Correct 6 ms 35408 KB Output is correct
22 Correct 7 ms 35408 KB Output is correct
23 Correct 7 ms 35408 KB Output is correct
24 Correct 7 ms 35408 KB Output is correct
25 Correct 6 ms 35552 KB Output is correct
26 Correct 6 ms 35576 KB Output is correct
27 Correct 6 ms 35408 KB Output is correct
28 Correct 6 ms 35544 KB Output is correct
29 Correct 7 ms 35664 KB Output is correct
30 Correct 6 ms 35408 KB Output is correct
31 Correct 671 ms 168708 KB Output is correct
32 Correct 101 ms 42176 KB Output is correct
33 Correct 620 ms 166036 KB Output is correct
34 Correct 640 ms 166660 KB Output is correct
35 Correct 760 ms 169260 KB Output is correct
36 Correct 771 ms 169280 KB Output is correct
37 Correct 460 ms 162552 KB Output is correct
38 Correct 477 ms 161952 KB Output is correct
39 Correct 384 ms 162076 KB Output is correct
40 Correct 407 ms 162592 KB Output is correct
41 Correct 342 ms 102064 KB Output is correct
42 Correct 349 ms 101512 KB Output is correct
43 Correct 83 ms 42860 KB Output is correct
44 Correct 354 ms 101580 KB Output is correct
45 Correct 326 ms 103272 KB Output is correct
46 Correct 309 ms 103700 KB Output is correct
47 Correct 202 ms 74700 KB Output is correct
48 Correct 225 ms 96116 KB Output is correct
49 Correct 261 ms 99676 KB Output is correct
50 Correct 260 ms 102024 KB Output is correct
51 Correct 233 ms 101572 KB Output is correct
52 Correct 165 ms 55160 KB Output is correct
53 Correct 154 ms 45216 KB Output is correct
54 Correct 414 ms 82600 KB Output is correct
55 Correct 374 ms 83040 KB Output is correct
56 Correct 398 ms 86520 KB Output is correct
57 Correct 365 ms 98520 KB Output is correct
58 Correct 353 ms 82288 KB Output is correct
59 Correct 358 ms 85320 KB Output is correct
60 Correct 386 ms 104712 KB Output is correct
61 Correct 168 ms 53948 KB Output is correct
62 Correct 180 ms 56028 KB Output is correct
63 Correct 478 ms 83640 KB Output is correct
64 Correct 459 ms 84856 KB Output is correct
65 Correct 445 ms 105156 KB Output is correct
66 Correct 387 ms 100116 KB Output is correct
67 Correct 217 ms 42272 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 35152 KB Output is correct
2 Correct 6 ms 35320 KB Output is correct
3 Correct 6 ms 35152 KB Output is correct
4 Correct 6 ms 35268 KB Output is correct
5 Correct 6 ms 35408 KB Output is correct
6 Correct 9 ms 35664 KB Output is correct
7 Correct 7 ms 35408 KB Output is correct
8 Correct 8 ms 35664 KB Output is correct
9 Correct 7 ms 35408 KB Output is correct
10 Correct 9 ms 35920 KB Output is correct
11 Correct 7 ms 35408 KB Output is correct
12 Correct 7 ms 35664 KB Output is correct
13 Correct 7 ms 35408 KB Output is correct
14 Correct 7 ms 35712 KB Output is correct
15 Correct 7 ms 35664 KB Output is correct
16 Correct 7 ms 35408 KB Output is correct
17 Correct 7 ms 35656 KB Output is correct
18 Correct 8 ms 35664 KB Output is correct
19 Correct 7 ms 35536 KB Output is correct
20 Correct 7 ms 35664 KB Output is correct
21 Correct 6 ms 35408 KB Output is correct
22 Correct 7 ms 35408 KB Output is correct
23 Correct 7 ms 35408 KB Output is correct
24 Correct 7 ms 35408 KB Output is correct
25 Correct 6 ms 35552 KB Output is correct
26 Correct 6 ms 35576 KB Output is correct
27 Correct 6 ms 35408 KB Output is correct
28 Correct 6 ms 35544 KB Output is correct
29 Correct 7 ms 35664 KB Output is correct
30 Correct 6 ms 35408 KB Output is correct
31 Correct 671 ms 168708 KB Output is correct
32 Correct 101 ms 42176 KB Output is correct
33 Correct 620 ms 166036 KB Output is correct
34 Correct 640 ms 166660 KB Output is correct
35 Correct 760 ms 169260 KB Output is correct
36 Correct 771 ms 169280 KB Output is correct
37 Correct 460 ms 162552 KB Output is correct
38 Correct 477 ms 161952 KB Output is correct
39 Correct 384 ms 162076 KB Output is correct
40 Correct 407 ms 162592 KB Output is correct
41 Correct 342 ms 102064 KB Output is correct
42 Correct 349 ms 101512 KB Output is correct
43 Correct 83 ms 42860 KB Output is correct
44 Correct 354 ms 101580 KB Output is correct
45 Correct 326 ms 103272 KB Output is correct
46 Correct 309 ms 103700 KB Output is correct
47 Correct 202 ms 74700 KB Output is correct
48 Correct 225 ms 96116 KB Output is correct
49 Correct 261 ms 99676 KB Output is correct
50 Correct 260 ms 102024 KB Output is correct
51 Correct 233 ms 101572 KB Output is correct
52 Correct 2538 ms 242688 KB Output is correct
53 Correct 1821 ms 341516 KB Output is correct
54 Correct 837 ms 123532 KB Output is correct
55 Correct 2326 ms 220576 KB Output is correct
56 Correct 2051 ms 343300 KB Output is correct
57 Correct 1917 ms 341292 KB Output is correct
58 Correct 824 ms 126188 KB Output is correct
59 Correct 2544 ms 232816 KB Output is correct
60 Correct 2657 ms 340092 KB Output is correct
61 Correct 2258 ms 340000 KB Output is correct
62 Correct 1852 ms 338696 KB Output is correct
63 Correct 2024 ms 347980 KB Output is correct
64 Correct 4144 ms 557468 KB Output is correct
65 Correct 2243 ms 67432 KB Output is correct
66 Correct 3936 ms 569612 KB Output is correct
67 Correct 1020 ms 128936 KB Output is correct
68 Correct 3556 ms 341192 KB Output is correct
69 Correct 3296 ms 244828 KB Output is correct
70 Correct 3606 ms 569172 KB Output is correct
71 Correct 3934 ms 569588 KB Output is correct
72 Correct 977 ms 130940 KB Output is correct
73 Correct 3318 ms 341436 KB Output is correct
74 Correct 3807 ms 384620 KB Output is correct
75 Correct 4061 ms 573660 KB Output is correct
76 Correct 1947 ms 558572 KB Output is correct
77 Correct 1909 ms 561708 KB Output is correct
78 Correct 2417 ms 564508 KB Output is correct
79 Correct 2620 ms 564856 KB Output is correct
80 Correct 2299 ms 563460 KB Output is correct
81 Correct 165 ms 55160 KB Output is correct
82 Correct 154 ms 45216 KB Output is correct
83 Correct 414 ms 82600 KB Output is correct
84 Correct 374 ms 83040 KB Output is correct
85 Correct 398 ms 86520 KB Output is correct
86 Correct 365 ms 98520 KB Output is correct
87 Correct 353 ms 82288 KB Output is correct
88 Correct 358 ms 85320 KB Output is correct
89 Correct 386 ms 104712 KB Output is correct
90 Correct 168 ms 53948 KB Output is correct
91 Correct 180 ms 56028 KB Output is correct
92 Correct 478 ms 83640 KB Output is correct
93 Correct 459 ms 84856 KB Output is correct
94 Correct 445 ms 105156 KB Output is correct
95 Correct 387 ms 100116 KB Output is correct
96 Correct 217 ms 42272 KB Output is correct
97 Correct 1178 ms 133752 KB Output is correct
98 Correct 1511 ms 58708 KB Output is correct
99 Correct 4624 ms 585680 KB Output is correct
100 Correct 1074 ms 92832 KB Output is correct
101 Correct 3763 ms 365636 KB Output is correct
102 Correct 4878 ms 620624 KB Output is correct
103 Correct 3251 ms 600244 KB Output is correct
104 Correct 3591 ms 575720 KB Output is correct
105 Correct 2388 ms 569588 KB Output is correct
106 Correct 2391 ms 596896 KB Output is correct
107 Correct 3658 ms 329948 KB Output is correct
108 Correct 4571 ms 236076 KB Output is correct
109 Correct 2517 ms 352552 KB Output is correct
110 Correct 2377 ms 345308 KB Output is correct
111 Correct 2486 ms 251068 KB Output is correct
112 Correct 2358 ms 324308 KB Output is correct
113 Correct 939 ms 136012 KB Output is correct
114 Correct 1324 ms 137764 KB Output is correct
115 Correct 4371 ms 259060 KB Output is correct
116 Correct 4462 ms 237916 KB Output is correct
117 Correct 3704 ms 326208 KB Output is correct
118 Correct 2310 ms 322360 KB Output is correct
119 Correct 1351 ms 70056 KB Output is correct
120 Correct 963 ms 217124 KB Output is correct
121 Correct 1163 ms 316516 KB Output is correct
122 Correct 1169 ms 318440 KB Output is correct
123 Correct 1348 ms 318872 KB Output is correct
124 Correct 1386 ms 319524 KB Output is correct
125 Correct 1268 ms 319348 KB Output is correct
126 Correct 1541 ms 309572 KB Output is correct