답안 #1079665

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1079665 2024-08-28T20:52:22 Z danikoynov Bulldozer (JOI17_bulldozer) C++14
100 / 100
1533 ms 65536 KB
#include<bits/stdc++.h>
#define endl '\n'

using namespace std;
typedef long long ll;

struct Point
{
    ll x, y;
    
    Point(ll _x = 0, ll _y = 0)
    {
        x = _x;
        y = _y;
    }
    
    void input()
    {
        cin >> x >> y;
    }
};
    
const int MAXN = 2010;
int n;
pair < Point, ll > spot[MAXN];
void input()
{
    cin >> n;
    for (int i = 1; i <= n; i ++)
    {
        spot[i].first.input();
        cin >> spot[i].second;
    }
}

struct Fraction
{
    ll num, dev;

    Fraction(ll _num = 0, ll _dev = 0)
    {
        num = _num;
        dev = _dev;
    }

    void rationalize()
    {
        ll nod = __gcd(num, dev);
        if (nod < 0)
            nod = - nod;
        num /= nod;
        dev /= nod;
    }

    bool operator < (const Fraction f) const
    {
        /// num / dev < f.num / f.dev
        return (num * f.dev) < (f.num * dev);
    }
};


bool cmp(pair < Point, ll > p1, pair < Point, ll > p2)
{
    if (p1.first.x != p2.first.x)
        return p1.first.x < p2.first.x;
    return p1.first.y < p2.first.y;
}


const ll INF = 1e18;

struct Node
{
    ll val[2], res;

    Node()
    {
        val[0] = INF;
        val[1] = -INF;
        res = 0;
    }
};

Node unite(Node lf, Node rf)
{
    Node mf;
    mf.val[0] = min(lf.val[0], rf.val[0]);
    mf.val[1] = max(lf.val[1], rf.val[1]);
    mf.res = max(lf.res, rf.res);
    mf.res = max(mf.res, rf.val[1] - lf.val[0]);
    return mf;
}

Node tree[4 * MAXN];
ll pref[MAXN];

void build(int root, int left, int right)
{
    if (left == right)
    {
        tree[root].val[0] = tree[root].val[1] = pref[left];
        return;
    }

    int mid = (left + right) / 2;
    build(root * 2, left, mid);
    build(root * 2 + 1, mid + 1, right);

    tree[root] = unite(tree[root * 2], tree[root * 2 + 1]);
}

void update(int root, int left, int right, int pivot)
{
    if (left == right)
    {
        tree[root].val[0] = tree[root].val[1] = pref[left];
        return;
    }

    int mid = (left + right) / 2;
    if (pivot <= mid)
        update(root * 2, left, mid, pivot);
    else
        update(root * 2 + 1, mid + 1, right, pivot);
    
    tree[root] = unite(tree[root * 2], tree[root * 2 + 1]);
}

Node query(int root, int left, int right, int qleft, int qright)
{
    if (left > qright || right < qleft)
        return Node();

    if (left >= qleft && right <= qright)
        return tree[root];
    
    int mid = (left + right) / 2;
    return unite(query(root * 2, left, mid, qleft, qright),
            query(root * 2 + 1, mid + 1, right, qleft, qright));
}


int position[MAXN], swapped[MAXN][MAXN];

Fraction get_slope(Point p1, Point p2)
{
    if (p1.x > p2.x)
        swap(p1, p2);
    if (p1.x == p2.x)
    {
        if (p1.y > p2.y)
            swap(p1, p2);
    }
    Fraction slope(p2.y - p1.y, p2.x - p1.x);
    slope.rationalize();
    return slope;
}

void simulate()
{
    if (n == 1)
    {
        ll result = 0;
        result = max(result, spot[1].second);
        cout << result << endl;
        return;
    }

    sort(spot + 1, spot + n + 1, cmp);
    for (int i = 1; i <= n; i ++)
        position[i] = i;

    vector < pair < Fraction, pair < int, int > > > events;
    for (int i = 1; i <= n; i ++)
        for (int j = i + 1; j <= n; j ++)
        {
            Fraction slope(spot[j].first.y - spot[i].first.y, 
                    spot[j].first.x - spot[i].first.x);
            slope.rationalize();
            events.push_back({slope, {i, j}});
        }

    sort(events.begin(), events.end());

    ll sum = 0, result = 0;
    for (int i = 1; i <= n; i ++)
    {
        sum += spot[i].second;
        if (sum < 0)
            sum = 0;
        result = max(result, sum);
        pref[i] = pref[i - 1] + spot[i].second;
    }
    //cout << "begin " << tree[1].best_sum << " " << cur << endl;
    
    build(1, 0, n);

    set < pair < Fraction, int > > change;
    for (int i = 1; i < n; i ++)
    {
        Fraction slope(spot[i + 1].first.y - spot[i].first.y, 
                spot[i + 1].first.x - spot[i].first.x);
        slope.rationalize();
        change.insert({slope, i});
    }

    ///for (pair < Fraction, pair < ll, ll > > event : events)
    int cs = 0;
    while(!change.empty())
    {
        Fraction cur = (*change.begin()).first;
        //cout << "----------------" << endl;
        while(!change.empty())
        {
        
            if (cur < (*change.begin()).first)
                break;
                
            int pivot = (*change.begin()).second;
            //cout << "points: " << endl;
            //for (int i = 1; i <= n; i ++)
            //{
            //    cout << spot[i].first.x << " : " << spot[i].first.y << endl;
            //}
            //cout << "pivot " << pivot << " " << (*change.begin()).first.num << " / " << (*change.begin()).first.dev << endl;
            //cout << "swap " << postion[pivot] << " : " << postion
            change.erase(change.begin());
            if (pivot > 1 && !swapped[position[pivot - 1]][position[pivot]])
                change.erase({get_slope(spot[pivot].first, spot[pivot - 1].first), pivot - 1});
            if (pivot + 2 <= n && !swapped[position[pivot + 1]][position[pivot + 2]])
                change.erase({get_slope(spot[pivot + 2].first, spot[pivot + 1].first), pivot + 1});
            
            pref[pivot] -= spot[pivot].second;
            pref[pivot] += spot[pivot + 1].second;

            update(1, 0, n, pivot);

            /**Node lf = query(1, 0, n, 0, pivot), rf = query(1, 0, n, pivot, n);
            result = max(result, pref[pivot] - lf.val[0]);
            result = max(result, rf.val[1] - pref[pivot]);*/
            
            swapped[position[pivot]][position[pivot + 1]] = 1;
            swapped[position[pivot + 1]][position[pivot]] = 1;
            swap(position[pivot], position[pivot + 1]);
            swap(spot[pivot], spot[pivot + 1]);

            if (pivot > 1 && !swapped[position[pivot - 1]][position[pivot]])
                change.insert({get_slope(spot[pivot].first, spot[pivot - 1].first), pivot - 1});
            if (pivot + 2 <= n && !swapped[position[pivot + 1]][position[pivot + 2]])
                change.insert({get_slope(spot[pivot + 2].first, spot[pivot + 1].first), pivot + 1});

        }

        result = max(result, tree[1].res);

        /**sum = 0;
        for (int i = 1; i <= n; i ++)
        {
            sum += spot[i].second;
            if (sum < 0)
                sum = 0;
            result = max(result, sum);
        }*/
        //Fraction slope = event.first;
        /**pair < ll, ll > pivots = event.second;
        //cout << pivots.first << " : " << pivots.second << endl;
        assert(abs(position[pivots.first] - position[pivots.second]) == 1);
        int pivot = min(position[pivots.first], position[pivots.second]);
        pref[pivot] -= spot[pivot].second;
        pref[pivot] += spot[pivot + 1].second;
        swap(spot[position[pivots.first]], spot[position[pivots.second]]);
        swap(position[pivots.first], position[pivots.second]);
        update(1, 0, n, pivot);

        Node lf = query(1, 0, n, 0, pivot), rf = query(1, 0, n, pivot, n);
        result = max(result, pref[pivot] - lf.val[0]);
        result = max(result, rf.val[1] - pref[pivot]);*/
        /**
        sum = 0, cur = 0;;
        for (int i = 1; i <= n; i ++)
        {
            sum += spot[i].second;
            if (sum < 0)
                sum = 0;
            cur = max(cur, sum);
            //result = max(result, sum);
        }

        cout << "step " << tree[1].best_sum << " " << cur << endl;*/
    }

    cout << result << endl;
}

void solve()
{
    input();
    simulate();
}
int main()
{   
    solve();
    return 0;
}

Compilation message

bulldozer.cpp: In function 'void simulate()':
bulldozer.cpp:209:9: warning: unused variable 'cs' [-Wunused-variable]
  209 |     int cs = 0;
      |         ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1304 KB Output is correct
2 Correct 2 ms 1308 KB Output is correct
3 Correct 1 ms 1308 KB Output is correct
4 Correct 1 ms 1308 KB Output is correct
5 Correct 1 ms 1308 KB Output is correct
6 Correct 1 ms 1308 KB Output is correct
7 Correct 1 ms 1308 KB Output is correct
8 Correct 2 ms 1308 KB Output is correct
9 Correct 1 ms 1308 KB Output is correct
10 Correct 2 ms 1308 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 1 ms 764 KB Output is correct
14 Correct 0 ms 604 KB Output is correct
15 Correct 0 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1308 KB Output is correct
2 Correct 4 ms 1388 KB Output is correct
3 Correct 4 ms 1308 KB Output is correct
4 Correct 4 ms 1304 KB Output is correct
5 Correct 3 ms 1308 KB Output is correct
6 Correct 4 ms 1280 KB Output is correct
7 Correct 5 ms 1304 KB Output is correct
8 Correct 4 ms 1308 KB Output is correct
9 Correct 4 ms 1304 KB Output is correct
10 Correct 3 ms 1304 KB Output is correct
11 Correct 1 ms 600 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 0 ms 604 KB Output is correct
14 Correct 0 ms 604 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 1 ms 600 KB Output is correct
17 Correct 0 ms 604 KB Output is correct
18 Correct 0 ms 688 KB Output is correct
19 Correct 1 ms 600 KB Output is correct
20 Correct 1 ms 856 KB Output is correct
21 Correct 3 ms 1304 KB Output is correct
22 Correct 3 ms 1304 KB Output is correct
23 Correct 3 ms 1308 KB Output is correct
24 Correct 3 ms 1308 KB Output is correct
25 Correct 3 ms 1308 KB Output is correct
26 Correct 3 ms 1308 KB Output is correct
27 Correct 3 ms 1304 KB Output is correct
28 Correct 3 ms 1308 KB Output is correct
29 Correct 3 ms 1308 KB Output is correct
30 Correct 3 ms 1304 KB Output is correct
31 Correct 3 ms 1308 KB Output is correct
32 Correct 3 ms 1464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1308 KB Output is correct
2 Correct 4 ms 1388 KB Output is correct
3 Correct 4 ms 1308 KB Output is correct
4 Correct 4 ms 1304 KB Output is correct
5 Correct 3 ms 1308 KB Output is correct
6 Correct 4 ms 1280 KB Output is correct
7 Correct 5 ms 1304 KB Output is correct
8 Correct 4 ms 1308 KB Output is correct
9 Correct 4 ms 1304 KB Output is correct
10 Correct 3 ms 1304 KB Output is correct
11 Correct 1 ms 600 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 0 ms 604 KB Output is correct
14 Correct 0 ms 604 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 1 ms 600 KB Output is correct
17 Correct 0 ms 604 KB Output is correct
18 Correct 0 ms 688 KB Output is correct
19 Correct 1 ms 600 KB Output is correct
20 Correct 1 ms 856 KB Output is correct
21 Correct 3 ms 1304 KB Output is correct
22 Correct 3 ms 1304 KB Output is correct
23 Correct 3 ms 1308 KB Output is correct
24 Correct 3 ms 1308 KB Output is correct
25 Correct 3 ms 1308 KB Output is correct
26 Correct 3 ms 1308 KB Output is correct
27 Correct 3 ms 1304 KB Output is correct
28 Correct 3 ms 1308 KB Output is correct
29 Correct 3 ms 1308 KB Output is correct
30 Correct 3 ms 1304 KB Output is correct
31 Correct 3 ms 1308 KB Output is correct
32 Correct 3 ms 1464 KB Output is correct
33 Correct 1469 ms 64416 KB Output is correct
34 Correct 1452 ms 65236 KB Output is correct
35 Correct 1472 ms 63896 KB Output is correct
36 Correct 1452 ms 65248 KB Output is correct
37 Correct 1469 ms 63432 KB Output is correct
38 Correct 1454 ms 64324 KB Output is correct
39 Correct 1458 ms 63996 KB Output is correct
40 Correct 1478 ms 64940 KB Output is correct
41 Correct 1465 ms 64796 KB Output is correct
42 Correct 1498 ms 64424 KB Output is correct
43 Correct 1360 ms 63856 KB Output is correct
44 Correct 1325 ms 64412 KB Output is correct
45 Correct 1325 ms 65168 KB Output is correct
46 Correct 1337 ms 64976 KB Output is correct
47 Correct 1339 ms 63780 KB Output is correct
48 Correct 1348 ms 63388 KB Output is correct
49 Correct 1378 ms 64512 KB Output is correct
50 Correct 1367 ms 63636 KB Output is correct
51 Correct 1334 ms 64672 KB Output is correct
52 Correct 1341 ms 64412 KB Output is correct
53 Correct 1310 ms 63852 KB Output is correct
54 Correct 1334 ms 64292 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1308 KB Output is correct
2 Correct 4 ms 1388 KB Output is correct
3 Correct 4 ms 1308 KB Output is correct
4 Correct 4 ms 1304 KB Output is correct
5 Correct 3 ms 1308 KB Output is correct
6 Correct 4 ms 1280 KB Output is correct
7 Correct 5 ms 1304 KB Output is correct
8 Correct 4 ms 1308 KB Output is correct
9 Correct 4 ms 1304 KB Output is correct
10 Correct 3 ms 1304 KB Output is correct
11 Correct 1 ms 600 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 0 ms 604 KB Output is correct
14 Correct 0 ms 604 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 1 ms 600 KB Output is correct
17 Correct 0 ms 604 KB Output is correct
18 Correct 0 ms 688 KB Output is correct
19 Correct 1 ms 600 KB Output is correct
20 Correct 1 ms 856 KB Output is correct
21 Correct 3 ms 1304 KB Output is correct
22 Correct 3 ms 1304 KB Output is correct
23 Correct 3 ms 1308 KB Output is correct
24 Correct 3 ms 1308 KB Output is correct
25 Correct 3 ms 1308 KB Output is correct
26 Correct 3 ms 1308 KB Output is correct
27 Correct 3 ms 1304 KB Output is correct
28 Correct 3 ms 1308 KB Output is correct
29 Correct 3 ms 1308 KB Output is correct
30 Correct 3 ms 1304 KB Output is correct
31 Correct 3 ms 1308 KB Output is correct
32 Correct 3 ms 1464 KB Output is correct
33 Correct 1469 ms 64416 KB Output is correct
34 Correct 1452 ms 65236 KB Output is correct
35 Correct 1472 ms 63896 KB Output is correct
36 Correct 1452 ms 65248 KB Output is correct
37 Correct 1469 ms 63432 KB Output is correct
38 Correct 1454 ms 64324 KB Output is correct
39 Correct 1458 ms 63996 KB Output is correct
40 Correct 1478 ms 64940 KB Output is correct
41 Correct 1465 ms 64796 KB Output is correct
42 Correct 1498 ms 64424 KB Output is correct
43 Correct 1360 ms 63856 KB Output is correct
44 Correct 1325 ms 64412 KB Output is correct
45 Correct 1325 ms 65168 KB Output is correct
46 Correct 1337 ms 64976 KB Output is correct
47 Correct 1339 ms 63780 KB Output is correct
48 Correct 1348 ms 63388 KB Output is correct
49 Correct 1378 ms 64512 KB Output is correct
50 Correct 1367 ms 63636 KB Output is correct
51 Correct 1334 ms 64672 KB Output is correct
52 Correct 1341 ms 64412 KB Output is correct
53 Correct 1310 ms 63852 KB Output is correct
54 Correct 1334 ms 64292 KB Output is correct
55 Correct 1458 ms 64748 KB Output is correct
56 Correct 1464 ms 65232 KB Output is correct
57 Correct 1513 ms 64320 KB Output is correct
58 Correct 1470 ms 63896 KB Output is correct
59 Correct 1453 ms 64920 KB Output is correct
60 Correct 1434 ms 64156 KB Output is correct
61 Correct 1463 ms 63372 KB Output is correct
62 Correct 1427 ms 63492 KB Output is correct
63 Correct 1502 ms 64300 KB Output is correct
64 Correct 1518 ms 64668 KB Output is correct
65 Correct 1509 ms 64920 KB Output is correct
66 Correct 1505 ms 65476 KB Output is correct
67 Correct 1499 ms 64272 KB Output is correct
68 Correct 1481 ms 64108 KB Output is correct
69 Correct 1443 ms 63640 KB Output is correct
70 Correct 1441 ms 63944 KB Output is correct
71 Correct 1466 ms 64156 KB Output is correct
72 Correct 1437 ms 64468 KB Output is correct
73 Correct 1450 ms 64924 KB Output is correct
74 Correct 1465 ms 64676 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1304 KB Output is correct
2 Correct 2 ms 1308 KB Output is correct
3 Correct 1 ms 1308 KB Output is correct
4 Correct 1 ms 1308 KB Output is correct
5 Correct 1 ms 1308 KB Output is correct
6 Correct 1 ms 1308 KB Output is correct
7 Correct 1 ms 1308 KB Output is correct
8 Correct 2 ms 1308 KB Output is correct
9 Correct 1 ms 1308 KB Output is correct
10 Correct 2 ms 1308 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 1 ms 764 KB Output is correct
14 Correct 0 ms 604 KB Output is correct
15 Correct 0 ms 604 KB Output is correct
16 Correct 4 ms 1308 KB Output is correct
17 Correct 4 ms 1388 KB Output is correct
18 Correct 4 ms 1308 KB Output is correct
19 Correct 4 ms 1304 KB Output is correct
20 Correct 3 ms 1308 KB Output is correct
21 Correct 4 ms 1280 KB Output is correct
22 Correct 5 ms 1304 KB Output is correct
23 Correct 4 ms 1308 KB Output is correct
24 Correct 4 ms 1304 KB Output is correct
25 Correct 3 ms 1304 KB Output is correct
26 Correct 1 ms 600 KB Output is correct
27 Correct 0 ms 604 KB Output is correct
28 Correct 0 ms 604 KB Output is correct
29 Correct 0 ms 604 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 1 ms 600 KB Output is correct
32 Correct 0 ms 604 KB Output is correct
33 Correct 0 ms 688 KB Output is correct
34 Correct 1 ms 600 KB Output is correct
35 Correct 1 ms 856 KB Output is correct
36 Correct 3 ms 1304 KB Output is correct
37 Correct 3 ms 1304 KB Output is correct
38 Correct 3 ms 1308 KB Output is correct
39 Correct 3 ms 1308 KB Output is correct
40 Correct 3 ms 1308 KB Output is correct
41 Correct 3 ms 1308 KB Output is correct
42 Correct 3 ms 1304 KB Output is correct
43 Correct 3 ms 1308 KB Output is correct
44 Correct 3 ms 1308 KB Output is correct
45 Correct 3 ms 1304 KB Output is correct
46 Correct 3 ms 1308 KB Output is correct
47 Correct 3 ms 1464 KB Output is correct
48 Correct 1469 ms 64416 KB Output is correct
49 Correct 1452 ms 65236 KB Output is correct
50 Correct 1472 ms 63896 KB Output is correct
51 Correct 1452 ms 65248 KB Output is correct
52 Correct 1469 ms 63432 KB Output is correct
53 Correct 1454 ms 64324 KB Output is correct
54 Correct 1458 ms 63996 KB Output is correct
55 Correct 1478 ms 64940 KB Output is correct
56 Correct 1465 ms 64796 KB Output is correct
57 Correct 1498 ms 64424 KB Output is correct
58 Correct 1360 ms 63856 KB Output is correct
59 Correct 1325 ms 64412 KB Output is correct
60 Correct 1325 ms 65168 KB Output is correct
61 Correct 1337 ms 64976 KB Output is correct
62 Correct 1339 ms 63780 KB Output is correct
63 Correct 1348 ms 63388 KB Output is correct
64 Correct 1378 ms 64512 KB Output is correct
65 Correct 1367 ms 63636 KB Output is correct
66 Correct 1334 ms 64672 KB Output is correct
67 Correct 1341 ms 64412 KB Output is correct
68 Correct 1310 ms 63852 KB Output is correct
69 Correct 1334 ms 64292 KB Output is correct
70 Correct 1458 ms 64748 KB Output is correct
71 Correct 1464 ms 65232 KB Output is correct
72 Correct 1513 ms 64320 KB Output is correct
73 Correct 1470 ms 63896 KB Output is correct
74 Correct 1453 ms 64920 KB Output is correct
75 Correct 1434 ms 64156 KB Output is correct
76 Correct 1463 ms 63372 KB Output is correct
77 Correct 1427 ms 63492 KB Output is correct
78 Correct 1502 ms 64300 KB Output is correct
79 Correct 1518 ms 64668 KB Output is correct
80 Correct 1509 ms 64920 KB Output is correct
81 Correct 1505 ms 65476 KB Output is correct
82 Correct 1499 ms 64272 KB Output is correct
83 Correct 1481 ms 64108 KB Output is correct
84 Correct 1443 ms 63640 KB Output is correct
85 Correct 1441 ms 63944 KB Output is correct
86 Correct 1466 ms 64156 KB Output is correct
87 Correct 1437 ms 64468 KB Output is correct
88 Correct 1450 ms 64924 KB Output is correct
89 Correct 1465 ms 64676 KB Output is correct
90 Correct 1455 ms 64724 KB Output is correct
91 Correct 1483 ms 63892 KB Output is correct
92 Correct 1453 ms 64156 KB Output is correct
93 Correct 1482 ms 64856 KB Output is correct
94 Correct 1460 ms 63408 KB Output is correct
95 Correct 1490 ms 64420 KB Output is correct
96 Correct 1497 ms 65176 KB Output is correct
97 Correct 1518 ms 64092 KB Output is correct
98 Correct 1519 ms 63364 KB Output is correct
99 Correct 1533 ms 63544 KB Output is correct
100 Correct 828 ms 64120 KB Output is correct
101 Correct 783 ms 64668 KB Output is correct
102 Correct 767 ms 65152 KB Output is correct
103 Correct 781 ms 65444 KB Output is correct
104 Correct 766 ms 64152 KB Output is correct
105 Correct 926 ms 63900 KB Output is correct
106 Correct 926 ms 63472 KB Output is correct
107 Correct 917 ms 64668 KB Output is correct
108 Correct 921 ms 63652 KB Output is correct
109 Correct 922 ms 64160 KB Output is correct
110 Correct 847 ms 64056 KB Output is correct
111 Correct 837 ms 63904 KB Output is correct
112 Correct 857 ms 64792 KB Output is correct
113 Correct 841 ms 65432 KB Output is correct
114 Correct 834 ms 63668 KB Output is correct
115 Correct 840 ms 64668 KB Output is correct
116 Correct 841 ms 65180 KB Output is correct
117 Correct 856 ms 63728 KB Output is correct
118 Correct 842 ms 64912 KB Output is correct
119 Correct 866 ms 64784 KB Output is correct
120 Correct 1 ms 604 KB Output is correct
121 Correct 0 ms 604 KB Output is correct
122 Correct 1184 ms 64196 KB Output is correct
123 Correct 1236 ms 63512 KB Output is correct
124 Correct 1261 ms 65536 KB Output is correct
125 Correct 1200 ms 65292 KB Output is correct
126 Correct 1187 ms 64668 KB Output is correct
127 Correct 1194 ms 64160 KB Output is correct
128 Correct 1203 ms 65256 KB Output is correct
129 Correct 1246 ms 65404 KB Output is correct
130 Correct 1226 ms 64092 KB Output is correct
131 Correct 1225 ms 65148 KB Output is correct
132 Correct 1198 ms 64672 KB Output is correct
133 Correct 1214 ms 64180 KB Output is correct