Submission #927781

# Submission time Handle Problem Language Result Execution time Memory
927781 2024-02-15T10:34:15 Z boris_mihov Two Dishes (JOI19_dishes) C++17
100 / 100
7546 ms 314672 KB
#include <algorithm>
#include <iostream>
#include <numeric>
#include <cassert>
#include <vector>

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

typedef long long llong;
const int MAXN = 1000000 + 10;
const int MAXLOG = 20;
const llong INF = 1e18;

int n, m;
template <typename T>
struct Fenwick
{
    T tree[MAXN];
    void update(int pos, T val)
    {
        for (int idx = pos ; idx <= m ; idx += idx & (-idx))
        {
            tree[idx] += val;
        }
    }

    T query(int pos)
    {
        T res = 0;
        for (int idx = pos ; idx > 0 ; idx -= idx & (-idx))
        {
            res += tree[idx];
        }

        return res;
    }

    int findKthZero(int k)
    {
        int idx = 0;
        for (int log = MAXLOG - 1 ; log >= 0 ; --log)
        {
            if (idx + (1 << log) <= m && (1 << log) - tree[idx + (1 << log)] < k)
            {
                idx += (1 << log);
                k -= (1 << log) - tree[idx];
            }
        }

        return idx + 1;
    }

    int findKthOne(int k)
    {
        int idx = 0;
        for (int log = MAXLOG - 1 ; log >= 0 ; --log)
        {
            if (idx + (1 << log) <= m && tree[idx + (1 << log)] < k)
            {
                idx += (1 << log);
                k -= tree[idx];
            }
        }

        return idx + 1;
    }
};

struct Fenwick2
{
    llong tree[MAXN];
    void pointUpdate(int pos, llong val)
    {
        for (int idx = pos ; idx <= m + 1 ; idx += idx & (-idx))
        {
            tree[idx] += val;
        }
    }

    llong query(int pos)
    {
        llong res = 0;
        for (int idx = pos ; idx > 0 ; idx -= idx & (-idx))
        {
            res += tree[idx];
        }

        return res;
    }

    void update(int pos, llong value)
    {
        llong val = query(pos);
        pointUpdate(pos, value - val);
        pointUpdate(pos + 1, val - value);
    }

    void rangeUpdate(int l, int r, int value)
    {
        pointUpdate(l, value);
        pointUpdate(r + 1, -value);
    }
};

Fenwick <int> fenwickNext;
Fenwick <llong> fenwickActive;
Fenwick2 dp;

struct Dish
{
    int time;
    llong limit;
    int reward;
    int idx;
    bool type;
};

Dish a[MAXN];
Dish b[MAXN];
llong prefixA[MAXN];
llong prefixB[MAXN];
bool isNext[MAXN];
bool isActive[MAXN];
llong dpBorderM[MAXN];
llong dpBorderN[MAXN];
llong active[MAXN];

int globalRow;
llong findValue(int col)
{
    if (col == m + 1)
    {
        return dp.query(m + 1);
    }

    int cnt = col - 1 - fenwickNext.query(col - 1);
    int pos = m;
    
    if (cnt != m - fenwickNext.query(m))
    {
        pos = fenwickNext.findKthZero(cnt + 1);
    }

    return fenwickActive.query(pos - 1) - fenwickActive.query(col - 1) + dp.query(pos);
}

void fix(int col)
{
    assert(col <= m);
    llong curr = dp.query(col);
    llong next = findValue(col + 1) + active[col];
    int res = isNext[col];
    fenwickNext.update(col, -res);

    int nextVal = 0;
    isNext[col] = false;
    if (curr < next) 
    {
        nextVal = 1;
        isNext[col] = true;
        fenwickNext.update(col, 1);
    }

    dp.update(col, std::max(curr, next));
    if (col > 1)
    {
        int queryRes = fenwickNext.query(col - 1);
        if (queryRes < col - 1)
        {
            int cntZeroesToNow = col - 1 - queryRes;
            int pos = fenwickNext.findKthZero(cntZeroesToNow);
            llong nextVal = findValue(pos + 1) + active[pos];
            if (nextVal > findValue(pos)) fix(pos);
        }

        if (queryRes > 0)
        {
            int cntOnesToNow = queryRes;
            int pos = fenwickNext.findKthOne(cntOnesToNow);
            llong nextVal = findValue(pos + 1) + active[pos];
            if (nextVal > findValue(pos)) fix(pos);
        }
    }
}

void applyUpdate(int to, int val)
{
    dp.rangeUpdate(1, to, val);
}

std::vector <int> activateAt[MAXN];
void solve()
{
    for (int i = 1 ; i <= n ; ++i)
    {
        prefixA[i] = prefixA[i - 1] + a[i].time;
    }

    for (int i = 1 ; i <= m ; ++i)
    {
        prefixB[i] = prefixB[i - 1] + b[i].time;
    }

    for (int aPos = n ; aPos >= 1 ; --aPos)
    {
        dpBorderM[aPos] = dpBorderM[aPos + 1] + (prefixA[aPos - 1] + prefixB[m] + a[aPos].time <= a[aPos].limit ? a[aPos].reward : 0);
    }

    for (int bPos = m ; bPos >= 1 ; --bPos)
    {
        dpBorderN[bPos] = dpBorderN[bPos + 1] + (prefixB[bPos - 1] + prefixA[n] + b[bPos].time <= b[bPos].limit ? b[bPos].reward : 0);
    }

    for (int i = 1 ; i <= m ; ++i)
    {
        int l = 0, r = n + 2, mid;
        while (l < r - 1)
        {
            mid = (l + r) / 2;
            if (prefixA[mid - 1] + prefixB[i] <= b[i].limit) l = mid;
            else r = mid;
        }

        activateAt[l].push_back(i);
    }

    globalRow = n + 1;
    for (int i = 1 ; i <= m ; ++i)
    {
        fenwickNext.update(i, 1);
        isNext[i] = true;
    }

    std::sort(activateAt[n + 1].begin(), activateAt[n + 1].end(), std::greater <int> ());
    for (int i = 1 ; i <= m ; ++i)
    {
        dp.update(i, dpBorderN[i]);
    }
    
    for (const int &idx : activateAt[globalRow])
    {
        active[idx] = b[idx].reward;
        fenwickActive.update(idx, b[idx].reward);
        fix(idx);
    }

    for (globalRow = n ; globalRow >= 1 ; --globalRow)
    {
        for (const int &idx : activateAt[globalRow])
        {
            dp.update(idx, findValue(idx));
        }
    
        int l = 0, r = m + 1, mid;
        while (l < r - 1)
        {
            mid = (l + r) / 2;
            if (prefixA[globalRow] + prefixB[mid - 1] <= a[globalRow].limit) l = mid;
            else r = mid;
        }

        if (l > 0)
        {
            dp.update(l, findValue(l));
        }

        for (const int &idx : activateAt[globalRow])
        {
            active[idx] = b[idx].reward;
            fenwickActive.update(idx, b[idx].reward);
        }


        if (l > 0) activateAt[globalRow].push_back(l);
        applyUpdate(l, a[globalRow].reward);

        dp.update(m + 1, dpBorderM[globalRow]);
        activateAt[globalRow].push_back(m);
        std::sort(activateAt[globalRow].begin(), activateAt[globalRow].end(), std::greater <int> ());

        for (const int &idx : activateAt[globalRow])
        {
            fix(idx);
        }
    }

    globalRow++;
    std::cout << findValue(1) << '\n';
}

void input()
{
    std::cin >> n >> m;
    for (int i = 1 ; i <= n ; ++i)
    {
        std::cin >> a[i].time >> a[i].limit >> a[i].reward;
        a[i].idx = i;
        a[i].type = false;
    }

    for (int i = 1 ; i <= m ; ++i)
    {
        std::cin >> b[i].time >> b[i].limit >> b[i].reward;
        b[i].idx = i;
        a[i].type = true;
    }
}

void fastIOI()
{
    std::ios_base :: sync_with_stdio(0);
    std::cout.tie(nullptr);
    std::cin.tie(nullptr);
}

signed main()
{
    fastIOI();
    input();
    solve();

    return 0;
}

Compilation message

dishes.cpp: In function 'void fix(int)':
dishes.cpp:156:9: warning: variable 'nextVal' set but not used [-Wunused-but-set-variable]
  156 |     int nextVal = 0;
      |         ^~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 474 ms 66228 KB Output is correct
2 Correct 453 ms 67368 KB Output is correct
3 Correct 322 ms 68652 KB Output is correct
4 Correct 352 ms 65492 KB Output is correct
5 Correct 7 ms 33372 KB Output is correct
6 Correct 517 ms 70964 KB Output is correct
7 Correct 205 ms 69836 KB Output is correct
8 Correct 84 ms 52308 KB Output is correct
9 Correct 324 ms 68556 KB Output is correct
10 Correct 537 ms 66176 KB Output is correct
11 Correct 299 ms 68552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 31320 KB Output is correct
2 Correct 6 ms 31320 KB Output is correct
3 Correct 6 ms 33372 KB Output is correct
4 Correct 7 ms 33372 KB Output is correct
5 Correct 8 ms 31324 KB Output is correct
6 Correct 7 ms 33372 KB Output is correct
7 Correct 6 ms 31324 KB Output is correct
8 Correct 6 ms 33372 KB Output is correct
9 Correct 7 ms 33368 KB Output is correct
10 Correct 6 ms 31324 KB Output is correct
11 Correct 6 ms 33376 KB Output is correct
12 Correct 7 ms 33368 KB Output is correct
13 Correct 8 ms 33372 KB Output is correct
14 Correct 7 ms 33372 KB Output is correct
15 Correct 7 ms 33368 KB Output is correct
16 Correct 7 ms 33624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 31320 KB Output is correct
2 Correct 6 ms 31320 KB Output is correct
3 Correct 6 ms 33372 KB Output is correct
4 Correct 7 ms 33372 KB Output is correct
5 Correct 8 ms 31324 KB Output is correct
6 Correct 7 ms 33372 KB Output is correct
7 Correct 6 ms 31324 KB Output is correct
8 Correct 6 ms 33372 KB Output is correct
9 Correct 7 ms 33368 KB Output is correct
10 Correct 6 ms 31324 KB Output is correct
11 Correct 6 ms 33376 KB Output is correct
12 Correct 7 ms 33368 KB Output is correct
13 Correct 8 ms 33372 KB Output is correct
14 Correct 7 ms 33372 KB Output is correct
15 Correct 7 ms 33368 KB Output is correct
16 Correct 7 ms 33624 KB Output is correct
17 Correct 9 ms 33628 KB Output is correct
18 Correct 10 ms 31580 KB Output is correct
19 Correct 12 ms 33624 KB Output is correct
20 Correct 10 ms 33644 KB Output is correct
21 Correct 11 ms 33464 KB Output is correct
22 Correct 12 ms 33640 KB Output is correct
23 Correct 13 ms 33628 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 31320 KB Output is correct
2 Correct 6 ms 31320 KB Output is correct
3 Correct 6 ms 33372 KB Output is correct
4 Correct 7 ms 33372 KB Output is correct
5 Correct 8 ms 31324 KB Output is correct
6 Correct 7 ms 33372 KB Output is correct
7 Correct 6 ms 31324 KB Output is correct
8 Correct 6 ms 33372 KB Output is correct
9 Correct 7 ms 33368 KB Output is correct
10 Correct 6 ms 31324 KB Output is correct
11 Correct 6 ms 33376 KB Output is correct
12 Correct 7 ms 33368 KB Output is correct
13 Correct 8 ms 33372 KB Output is correct
14 Correct 7 ms 33372 KB Output is correct
15 Correct 7 ms 33368 KB Output is correct
16 Correct 7 ms 33624 KB Output is correct
17 Correct 9 ms 33628 KB Output is correct
18 Correct 10 ms 31580 KB Output is correct
19 Correct 12 ms 33624 KB Output is correct
20 Correct 10 ms 33644 KB Output is correct
21 Correct 11 ms 33464 KB Output is correct
22 Correct 12 ms 33640 KB Output is correct
23 Correct 13 ms 33628 KB Output is correct
24 Correct 302 ms 68388 KB Output is correct
25 Correct 288 ms 65748 KB Output is correct
26 Correct 403 ms 68376 KB Output is correct
27 Correct 290 ms 66640 KB Output is correct
28 Correct 569 ms 73868 KB Output is correct
29 Correct 325 ms 68412 KB Output is correct
30 Correct 956 ms 67984 KB Output is correct
31 Correct 212 ms 63500 KB Output is correct
32 Correct 77 ms 52308 KB Output is correct
33 Correct 638 ms 68044 KB Output is correct
34 Correct 737 ms 70484 KB Output is correct
35 Correct 966 ms 67884 KB Output is correct
36 Correct 918 ms 68212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 31320 KB Output is correct
2 Correct 6 ms 31320 KB Output is correct
3 Correct 6 ms 33372 KB Output is correct
4 Correct 7 ms 33372 KB Output is correct
5 Correct 8 ms 31324 KB Output is correct
6 Correct 7 ms 33372 KB Output is correct
7 Correct 6 ms 31324 KB Output is correct
8 Correct 6 ms 33372 KB Output is correct
9 Correct 7 ms 33368 KB Output is correct
10 Correct 6 ms 31324 KB Output is correct
11 Correct 6 ms 33376 KB Output is correct
12 Correct 7 ms 33368 KB Output is correct
13 Correct 8 ms 33372 KB Output is correct
14 Correct 7 ms 33372 KB Output is correct
15 Correct 7 ms 33368 KB Output is correct
16 Correct 7 ms 33624 KB Output is correct
17 Correct 9 ms 33628 KB Output is correct
18 Correct 10 ms 31580 KB Output is correct
19 Correct 12 ms 33624 KB Output is correct
20 Correct 10 ms 33644 KB Output is correct
21 Correct 11 ms 33464 KB Output is correct
22 Correct 12 ms 33640 KB Output is correct
23 Correct 13 ms 33628 KB Output is correct
24 Correct 302 ms 68388 KB Output is correct
25 Correct 288 ms 65748 KB Output is correct
26 Correct 403 ms 68376 KB Output is correct
27 Correct 290 ms 66640 KB Output is correct
28 Correct 569 ms 73868 KB Output is correct
29 Correct 325 ms 68412 KB Output is correct
30 Correct 956 ms 67984 KB Output is correct
31 Correct 212 ms 63500 KB Output is correct
32 Correct 77 ms 52308 KB Output is correct
33 Correct 638 ms 68044 KB Output is correct
34 Correct 737 ms 70484 KB Output is correct
35 Correct 966 ms 67884 KB Output is correct
36 Correct 918 ms 68212 KB Output is correct
37 Correct 375 ms 68532 KB Output is correct
38 Correct 308 ms 66216 KB Output is correct
39 Correct 517 ms 66376 KB Output is correct
40 Correct 486 ms 82088 KB Output is correct
41 Correct 6 ms 33368 KB Output is correct
42 Correct 1053 ms 68512 KB Output is correct
43 Correct 616 ms 68060 KB Output is correct
44 Correct 720 ms 69428 KB Output is correct
45 Correct 994 ms 68036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 31320 KB Output is correct
2 Correct 6 ms 31320 KB Output is correct
3 Correct 6 ms 33372 KB Output is correct
4 Correct 7 ms 33372 KB Output is correct
5 Correct 8 ms 31324 KB Output is correct
6 Correct 7 ms 33372 KB Output is correct
7 Correct 6 ms 31324 KB Output is correct
8 Correct 6 ms 33372 KB Output is correct
9 Correct 7 ms 33368 KB Output is correct
10 Correct 6 ms 31324 KB Output is correct
11 Correct 6 ms 33376 KB Output is correct
12 Correct 7 ms 33368 KB Output is correct
13 Correct 8 ms 33372 KB Output is correct
14 Correct 7 ms 33372 KB Output is correct
15 Correct 7 ms 33368 KB Output is correct
16 Correct 7 ms 33624 KB Output is correct
17 Correct 9 ms 33628 KB Output is correct
18 Correct 10 ms 31580 KB Output is correct
19 Correct 12 ms 33624 KB Output is correct
20 Correct 10 ms 33644 KB Output is correct
21 Correct 11 ms 33464 KB Output is correct
22 Correct 12 ms 33640 KB Output is correct
23 Correct 13 ms 33628 KB Output is correct
24 Correct 302 ms 68388 KB Output is correct
25 Correct 288 ms 65748 KB Output is correct
26 Correct 403 ms 68376 KB Output is correct
27 Correct 290 ms 66640 KB Output is correct
28 Correct 569 ms 73868 KB Output is correct
29 Correct 325 ms 68412 KB Output is correct
30 Correct 956 ms 67984 KB Output is correct
31 Correct 212 ms 63500 KB Output is correct
32 Correct 77 ms 52308 KB Output is correct
33 Correct 638 ms 68044 KB Output is correct
34 Correct 737 ms 70484 KB Output is correct
35 Correct 966 ms 67884 KB Output is correct
36 Correct 918 ms 68212 KB Output is correct
37 Correct 375 ms 68532 KB Output is correct
38 Correct 308 ms 66216 KB Output is correct
39 Correct 517 ms 66376 KB Output is correct
40 Correct 486 ms 82088 KB Output is correct
41 Correct 6 ms 33368 KB Output is correct
42 Correct 1053 ms 68512 KB Output is correct
43 Correct 616 ms 68060 KB Output is correct
44 Correct 720 ms 69428 KB Output is correct
45 Correct 994 ms 68036 KB Output is correct
46 Correct 2001 ms 181572 KB Output is correct
47 Correct 1677 ms 177544 KB Output is correct
48 Correct 2879 ms 177556 KB Output is correct
49 Correct 2507 ms 255684 KB Output is correct
50 Correct 7546 ms 179100 KB Output is correct
51 Correct 3981 ms 246376 KB Output is correct
52 Correct 4778 ms 247856 KB Output is correct
53 Correct 6689 ms 219332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 474 ms 66228 KB Output is correct
2 Correct 453 ms 67368 KB Output is correct
3 Correct 322 ms 68652 KB Output is correct
4 Correct 352 ms 65492 KB Output is correct
5 Correct 7 ms 33372 KB Output is correct
6 Correct 517 ms 70964 KB Output is correct
7 Correct 205 ms 69836 KB Output is correct
8 Correct 84 ms 52308 KB Output is correct
9 Correct 324 ms 68556 KB Output is correct
10 Correct 537 ms 66176 KB Output is correct
11 Correct 299 ms 68552 KB Output is correct
12 Correct 6 ms 31320 KB Output is correct
13 Correct 6 ms 31320 KB Output is correct
14 Correct 6 ms 33372 KB Output is correct
15 Correct 7 ms 33372 KB Output is correct
16 Correct 8 ms 31324 KB Output is correct
17 Correct 7 ms 33372 KB Output is correct
18 Correct 6 ms 31324 KB Output is correct
19 Correct 6 ms 33372 KB Output is correct
20 Correct 7 ms 33368 KB Output is correct
21 Correct 6 ms 31324 KB Output is correct
22 Correct 6 ms 33376 KB Output is correct
23 Correct 7 ms 33368 KB Output is correct
24 Correct 8 ms 33372 KB Output is correct
25 Correct 7 ms 33372 KB Output is correct
26 Correct 7 ms 33368 KB Output is correct
27 Correct 7 ms 33624 KB Output is correct
28 Correct 9 ms 33628 KB Output is correct
29 Correct 10 ms 31580 KB Output is correct
30 Correct 12 ms 33624 KB Output is correct
31 Correct 10 ms 33644 KB Output is correct
32 Correct 11 ms 33464 KB Output is correct
33 Correct 12 ms 33640 KB Output is correct
34 Correct 13 ms 33628 KB Output is correct
35 Correct 302 ms 68388 KB Output is correct
36 Correct 288 ms 65748 KB Output is correct
37 Correct 403 ms 68376 KB Output is correct
38 Correct 290 ms 66640 KB Output is correct
39 Correct 569 ms 73868 KB Output is correct
40 Correct 325 ms 68412 KB Output is correct
41 Correct 956 ms 67984 KB Output is correct
42 Correct 212 ms 63500 KB Output is correct
43 Correct 77 ms 52308 KB Output is correct
44 Correct 638 ms 68044 KB Output is correct
45 Correct 737 ms 70484 KB Output is correct
46 Correct 966 ms 67884 KB Output is correct
47 Correct 918 ms 68212 KB Output is correct
48 Correct 375 ms 68532 KB Output is correct
49 Correct 308 ms 66216 KB Output is correct
50 Correct 517 ms 66376 KB Output is correct
51 Correct 486 ms 82088 KB Output is correct
52 Correct 6 ms 33368 KB Output is correct
53 Correct 1053 ms 68512 KB Output is correct
54 Correct 616 ms 68060 KB Output is correct
55 Correct 720 ms 69428 KB Output is correct
56 Correct 994 ms 68036 KB Output is correct
57 Correct 395 ms 76232 KB Output is correct
58 Correct 386 ms 67008 KB Output is correct
59 Correct 514 ms 81800 KB Output is correct
60 Correct 541 ms 66180 KB Output is correct
61 Correct 908 ms 65092 KB Output is correct
62 Correct 6 ms 33372 KB Output is correct
63 Correct 1030 ms 68068 KB Output is correct
64 Correct 647 ms 68124 KB Output is correct
65 Correct 807 ms 71024 KB Output is correct
66 Correct 936 ms 68436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 474 ms 66228 KB Output is correct
2 Correct 453 ms 67368 KB Output is correct
3 Correct 322 ms 68652 KB Output is correct
4 Correct 352 ms 65492 KB Output is correct
5 Correct 7 ms 33372 KB Output is correct
6 Correct 517 ms 70964 KB Output is correct
7 Correct 205 ms 69836 KB Output is correct
8 Correct 84 ms 52308 KB Output is correct
9 Correct 324 ms 68556 KB Output is correct
10 Correct 537 ms 66176 KB Output is correct
11 Correct 299 ms 68552 KB Output is correct
12 Correct 6 ms 31320 KB Output is correct
13 Correct 6 ms 31320 KB Output is correct
14 Correct 6 ms 33372 KB Output is correct
15 Correct 7 ms 33372 KB Output is correct
16 Correct 8 ms 31324 KB Output is correct
17 Correct 7 ms 33372 KB Output is correct
18 Correct 6 ms 31324 KB Output is correct
19 Correct 6 ms 33372 KB Output is correct
20 Correct 7 ms 33368 KB Output is correct
21 Correct 6 ms 31324 KB Output is correct
22 Correct 6 ms 33376 KB Output is correct
23 Correct 7 ms 33368 KB Output is correct
24 Correct 8 ms 33372 KB Output is correct
25 Correct 7 ms 33372 KB Output is correct
26 Correct 7 ms 33368 KB Output is correct
27 Correct 7 ms 33624 KB Output is correct
28 Correct 9 ms 33628 KB Output is correct
29 Correct 10 ms 31580 KB Output is correct
30 Correct 12 ms 33624 KB Output is correct
31 Correct 10 ms 33644 KB Output is correct
32 Correct 11 ms 33464 KB Output is correct
33 Correct 12 ms 33640 KB Output is correct
34 Correct 13 ms 33628 KB Output is correct
35 Correct 302 ms 68388 KB Output is correct
36 Correct 288 ms 65748 KB Output is correct
37 Correct 403 ms 68376 KB Output is correct
38 Correct 290 ms 66640 KB Output is correct
39 Correct 569 ms 73868 KB Output is correct
40 Correct 325 ms 68412 KB Output is correct
41 Correct 956 ms 67984 KB Output is correct
42 Correct 212 ms 63500 KB Output is correct
43 Correct 77 ms 52308 KB Output is correct
44 Correct 638 ms 68044 KB Output is correct
45 Correct 737 ms 70484 KB Output is correct
46 Correct 966 ms 67884 KB Output is correct
47 Correct 918 ms 68212 KB Output is correct
48 Correct 375 ms 68532 KB Output is correct
49 Correct 308 ms 66216 KB Output is correct
50 Correct 517 ms 66376 KB Output is correct
51 Correct 486 ms 82088 KB Output is correct
52 Correct 6 ms 33368 KB Output is correct
53 Correct 1053 ms 68512 KB Output is correct
54 Correct 616 ms 68060 KB Output is correct
55 Correct 720 ms 69428 KB Output is correct
56 Correct 994 ms 68036 KB Output is correct
57 Correct 2001 ms 181572 KB Output is correct
58 Correct 1677 ms 177544 KB Output is correct
59 Correct 2879 ms 177556 KB Output is correct
60 Correct 2507 ms 255684 KB Output is correct
61 Correct 7546 ms 179100 KB Output is correct
62 Correct 3981 ms 246376 KB Output is correct
63 Correct 4778 ms 247856 KB Output is correct
64 Correct 6689 ms 219332 KB Output is correct
65 Correct 395 ms 76232 KB Output is correct
66 Correct 386 ms 67008 KB Output is correct
67 Correct 514 ms 81800 KB Output is correct
68 Correct 541 ms 66180 KB Output is correct
69 Correct 908 ms 65092 KB Output is correct
70 Correct 6 ms 33372 KB Output is correct
71 Correct 1030 ms 68068 KB Output is correct
72 Correct 647 ms 68124 KB Output is correct
73 Correct 807 ms 71024 KB Output is correct
74 Correct 936 ms 68436 KB Output is correct
75 Correct 2110 ms 292180 KB Output is correct
76 Correct 2051 ms 249512 KB Output is correct
77 Correct 2554 ms 314672 KB Output is correct
78 Correct 2820 ms 236652 KB Output is correct
79 Correct 7447 ms 249684 KB Output is correct
80 Correct 3886 ms 246292 KB Output is correct
81 Correct 4791 ms 264172 KB Output is correct
82 Correct 7087 ms 217956 KB Output is correct
83 Correct 6428 ms 241180 KB Output is correct