QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#335690#4077. 뚫기duongnc0007 85ms12136kbC++205.6kb2024-02-23 19:47:062024-02-23 19:47:08

Judging History

你现在查看的是最新测评结果

  • [2024-02-23 19:47:08]
  • 评测
  • 测评结果:7
  • 用时:85ms
  • 内存:12136kb
  • [2024-02-23 19:47:06]
  • 提交

answer

#include <bits/stdc++.h>
#define taskname ""
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define i64 long long
#define pb push_back
#define ff first
#define ss second
#define isz(x) (int)x.size()
using namespace std;

const i64 oo = 1e18;

#define pli pair<i64, int>

struct SegmentTree {
    struct node {
        pli mn_cost = {oo, -1};
        i64 lz_cost = 0;
        pli lz_mn_cost = {oo, -1};

        node() {}
        node(pli mn_cost) : mn_cost(mn_cost) {}

        node operator + (const node &rhs) {
            node res;
            res.mn_cost = min(mn_cost, rhs.mn_cost);
            return res;
        }
    };

    int n;
    vector<node> data;

    SegmentTree() {}
    SegmentTree(int n) : n(n), data(4 * n + 10) {}

    void init(int n, pli val) {
        this->n = n;
        data.assign(4 * n + 10, node(val));
        // for (auto cur : data) cout << cur.mn_cost.ff << " " << cur.mn_cost.ss << endl;
    }

    void apply(int idx, i64 cost, pli mn_cost) {
        // if (mn_cost.ss != -1) cout << idx << " " << data[idx].mn_cost.ff << " " << data[idx].mn_cost.ss << endl;
        // if (mn_cost.ss != -1) cout << idx << " " << cost << " " << mn_cost.ff << " " << mn_cost.ss << endl;
        data[idx].mn_cost.ff += cost;
        data[idx].mn_cost = min(data[idx].mn_cost, mn_cost);

        data[idx].lz_cost += cost;
        data[idx].lz_mn_cost.ff += cost;
        data[idx].lz_mn_cost = min(data[idx].lz_mn_cost, mn_cost);
        // if (mn_cost.ss != -1) cout << idx << " " << data[idx].mn_cost.ff << " " << data[idx].mn_cost.ss << endl;
    }

    void down(int idx) {
        i64 cost = data[idx].lz_cost;
        pli mn_cost = data[idx].lz_mn_cost;
        // if (cost == 0 and mn_cost == pair{oo, -1}) return;
        apply(idx << 1, cost, mn_cost);
        apply(idx << 1 | 1, cost, mn_cost);
        data[idx].lz_cost = 0;
        data[idx].lz_mn_cost = {oo, -1};
    }

    void update(int l, int r, int idx, int u, int v, i64 cost, pli mn_cost) {
        if (u <= l and r <= v) {
            apply(idx, cost, mn_cost);
            return;
        }
        down(idx);
        int mid = (l + r) >> 1;
        if (u <= mid) update(l, mid, idx << 1, u, v, cost, mn_cost);
        if (mid + 1 <= v) update(mid + 1, r, idx << 1 | 1, u, v, cost, mn_cost);
        data[idx] = data[idx << 1] + data[idx << 1 | 1];
    }

    void update(int u, int v, i64 cost, pli mn_cost) {
        // cout << u << " -> " << v << " " << cost << " {" << mn_cost.ff << ", " << mn_cost.ss << "}" << endl;
        update(0, n - 1, 1, u, v, cost, mn_cost);
    }

    void dfs(int l, int r, int idx) {
        // cout << l << " -> " << r << " " << idx << " = " << data[idx].mn_cost.ff << " " << data[idx].mn_cost.ss << endl;
        if (l == r) return;
        int mid = (l + r) >> 1;
        dfs(l, mid, idx << 1); dfs(mid + 1, r, idx << 1 | 1);
    }

    void dfs() {
        dfs(0, n - 1, 1);
    }
} st;

i64 calc(pair<int, int> step, int A, int B) {
    return 1ll * step.ff * A + 1ll * step.ss * B;
}

vector<pair<int, int>> possible_step;

void init(int n, int m, vector<int> yl, vector<int> yr) {
    vector<int> cpr;
    cpr.emplace_back(0);
    cpr.emplace_back(m);
    for (int i = 0; i < n; ++i) {
        cpr.emplace_back(yl[i]);
        cpr.emplace_back(yr[i] + 1);
    }
    sort(all(cpr)); cpr.erase(unique(all(cpr)), cpr.end());
    for (int i = 0; i < n; ++i) {
        yl[i] = lower_bound(all(cpr), yl[i]) - cpr.begin();
        yr[i] = lower_bound(all(cpr), yr[i] + 1) - cpr.begin();
    }
    m = isz(cpr);

    // input: cost
    // output: step, minimize step a
    auto solve = [&](int a, int b) -> pair<int, int> {
        // cout << "solve: " << a << " " << b << endl;
        st.init(m - 1, {0, 0});
        for (int i = 0; i < n; ++i) {
            st.update(yl[i], yr[i] - 1, b, {oo, -1});
            auto cur = st.data[1].mn_cost;
            // st.dfs();
            // cout << i << ": " << cur.ff << " " << cur.ss << endl;
            cur.ff += a, cur.ss++;
            st.update(0, m - 1, 0, cur);
        }
        auto cur = st.data[1].mn_cost;
        return {cur.ss, b ? (cur.ff - 1ll * a * cur.ss) / b : n};
    };

    // auto val = solve(0, 1);
    // cout << val.ff << " " << val.ss << endl;

    possible_step.emplace_back(solve(0, 1));
    auto conquer = [&](auto self, pair<int, int> l, pair<int, int> r) -> void {
        pair<int, int> m(r.ss - l.ss, l.ff - r.ff);
        auto sm = solve(m.ff, m.ss);
        // cout << m.ff << " " << m.ss << " " << sm.ff << " " << sm.ss << endl;
        if (calc(sm, m.ff, m.ss) != calc(l, m.ff, m.ss)) {
            // assert(0);
            self(self, l, sm);
            self(self, sm, r);
        }
        else {
            possible_step.push_back(r);
        }
    };
    conquer(conquer, solve(0, 1), solve(1, 0));

    // for (auto [x, y] : possible_step) cout << x << " " << y << endl;
}

i64 minimize(int A, int B) {
    int l = 0, r = isz(possible_step);
    while (l < r) {
        int mid = (l + r) >> 1;
        if (calc(possible_step[mid], A, B) < calc(possible_step[mid + 1], A, B)) r = mid;
        else l = mid + 1;
    }
    return calc(possible_step[l], A, B);
}

#ifdef CDuongg
int main() {
    freopen("bai3.inp", "r", stdin);
    freopen("bai3.out", "w", stdout);
    int n, m, q; cin >> n >> m >> q;
    vector<int> y1(n), y2(n);
    for (int i = 0; i < n; ++i) cin >> y1[i] >> y2[i];
    init(n, m, y1, y2);
    while (q--) {
        int A, B;
        cin >> A >> B;
        cout << minimize(A, B) << endl;
    }
}
#endif

详细

Subtask #1:

score: 7
Accepted

Test #1:

score: 7
Accepted
time: 0ms
memory: 3576kb

input:

6 2 1
1 1
0 1
0 0
0 1
1 1
0 1
724642704 32998300

output:

131993200

result:

ok single line: '131993200'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

10 3 1
1 2
1 2
0 2
1 2
2 2
0 2
1 1
0 2
0 1
1 2
686137157 255736273

output:

1022945092

result:

ok single line: '1022945092'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3832kb

input:

50 5 1
0 1
4 4
3 4
1 4
0 3
1 4
1 3
0 4
0 0
0 3
0 1
0 3
0 0
2 3
0 0
3 4
1 1
2 2
0 1
0 1
0 4
1 4
3 4
0 1
0 4
2 2
0 3
0 3
0 4
0 3
0 4
2 4
0 0
4 4
3 3
1 4
2 3
0 2
0 1
0 3
2 3
3 3
2 3
2 4
2 2
0 2
1 2
0 4
1 3
2 4
404445464 361978179

output:

6196096328

result:

ok single line: '6196096328'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

121 7 1
2 5
5 6
1 6
0 6
4 5
1 6
2 4
2 4
0 6
2 6
1 5
3 4
0 4
1 6
0 2
0 5
2 6
1 6
1 2
1 4
0 6
1 5
0 5
0 6
0 6
0 6
1 4
0 4
3 5
1 6
0 0
0 5
1 3
0 6
0 3
1 3
1 2
2 3
0 5
1 4
2 4
0 5
0 0
1 3
1 6
0 2
1 6
2 5
2 4
0 6
1 2
2 4
3 4
0 5
0 6
0 6
1 6
0 6
0 4
2 6
0 1
0 2
0 3
0 5
3 6
2 4
4 4
1 6
5 5
0 4
0 5
0 0
2 3
...

output:

16848723090

result:

ok single line: '16848723090'

Test #5:

score: 0
Accepted
time: 1ms
memory: 3640kb

input:

243 9 1
0 7
1 7
0 3
3 7
1 8
5 6
4 6
3 5
5 6
0 6
0 8
1 8
7 8
4 8
1 8
0 5
3 3
5 8
5 7
8 8
3 6
0 6
4 4
1 3
0 7
2 5
0 2
6 6
4 7
1 3
0 8
1 4
0 8
2 8
6 8
5 8
1 8
0 8
7 8
3 3
3 4
0 8
6 8
0 4
2 8
0 8
1 7
0 6
4 4
1 8
6 8
0 7
4 8
0 8
1 5
4 7
0 8
3 3
1 1
5 8
1 4
5 7
3 4
1 7
1 8
1 8
6 8
0 4
0 8
2 8
3 7
2 8
0 3
...

output:

27719095584

result:

ok single line: '27719095584'

Test #6:

score: 0
Accepted
time: 4ms
memory: 3916kb

input:

1000 102 1
46 74
33 80
4 84
22 96
1 100
10 36
35 68
0 65
4 26
26 93
25 90
0 79
14 101
24 57
4 53
37 60
4 77
32 97
44 70
29 65
44 99
2 49
0 86
69 76
3 57
1 93
16 83
38 60
1 86
1 40
19 97
28 94
4 45
16 72
23 94
26 89
20 60
29 32
21 39
14 83
26 74
24 77
15 88
72 93
12 90
1 81
27 60
15 90
36 78
18 39
12...

output:

23789206007

result:

ok single line: '23789206007'

Test #7:

score: 0
Accepted
time: 8ms
memory: 3612kb

input:

2000 123 1
48 81
27 95
16 109
19 106
26 115
4 116
66 83
2 111
39 118
15 47
21 122
1 120
78 101
35 120
55 95
36 59
75 75
42 64
71 105
11 121
31 122
30 112
93 116
1 61
77 84
26 90
28 109
14 116
9 118
80 91
8 101
13 113
29 51
2 118
5 77
23 93
25 108
3 120
8 120
22 64
36 65
7 83
7 115
14 93
8 50
7 116
5...

output:

40092503040

result:

ok single line: '40092503040'

Test #8:

score: 0
Accepted
time: 13ms
memory: 3752kb

input:

3000 143 1
0 142
28 140
36 139
27 48
1 137
21 142
35 103
40 91
55 82
2 135
27 123
42 58
38 126
105 106
43 65
13 103
78 99
71 102
21 106
94 127
31 40
14 131
94 120
1 117
5 128
48 120
27 135
31 107
49 107
2 132
89 102
22 123
23 139
76 137
125 136
80 122
12 127
17 91
84 136
82 139
45 131
38 85
9 142
24...

output:

53183710390

result:

ok single line: '53183710390'

Test #9:

score: 0
Accepted
time: 13ms
memory: 3944kb

input:

3000 123 1
38 120
3 97
6 57
11 11
29 76
39 115
69 89
57 122
11 122
43 66
46 104
6 43
4 119
8 59
28 107
73 102
18 119
70 108
62 95
4 115
19 79
29 91
2 40
114 120
67 83
37 46
14 110
4 70
2 35
35 120
21 28
20 111
4 121
10 103
7 122
36 105
21 28
15 26
54 72
65 113
24 118
58 115
49 115
13 112
105 120
0 1...

output:

9990597533

result:

ok single line: '9990597533'

Test #10:

score: 0
Accepted
time: 13ms
memory: 3912kb

input:

3000 102 1
94 95
51 101
91 99
9 92
8 80
2 60
45 57
1 96
40 83
8 8
15 87
10 98
44 89
40 96
13 62
4 67
6 35
0 101
36 95
15 53
56 86
55 88
38 74
11 50
0 61
0 93
32 69
7 60
32 82
9 98
7 97
18 100
70 91
26 80
27 101
21 69
0 101
43 49
45 97
17 73
1 12
0 36
40 86
44 92
57 68
15 87
57 68
54 75
66 101
10 88
...

output:

69226624268

result:

ok single line: '69226624268'

Test #11:

score: 0
Accepted
time: 6ms
memory: 3904kb

input:

3000 6 1
4 4
5 5
2 2
0 5
3 3
0 5
0 4
1 4
0 2
0 4
1 5
1 5
0 3
4 5
2 3
1 5
1 3
3 5
0 3
3 3
3 5
1 3
2 2
1 5
0 1
3 4
2 4
0 0
4 4
0 2
1 4
3 4
1 3
0 1
0 1
0 0
2 4
0 2
0 4
2 5
0 5
0 4
0 1
0 3
1 5
2 4
2 4
0 5
2 5
3 4
0 5
1 5
4 5
2 4
1 1
1 3
0 5
0 4
0 3
5 5
1 5
0 2
1 5
2 5
0 5
0 3
2 3
3 4
4 4
2 3
2 5
0 1
4 5...

output:

282532939566

result:

ok single line: '282532939566'

Test #12:

score: 0
Accepted
time: 7ms
memory: 3780kb

input:

3000 7 1
2 6
1 6
1 2
5 6
1 4
2 6
2 6
1 1
2 6
2 4
1 3
1 3
2 6
0 6
3 4
1 2
1 3
0 5
0 0
0 0
0 3
3 6
0 4
4 6
1 1
0 0
2 4
0 5
3 6
2 4
2 4
1 4
2 5
4 5
2 4
2 5
0 6
2 6
4 5
2 3
0 5
4 4
3 6
1 6
5 5
1 6
2 4
2 4
0 6
1 6
3 4
0 5
2 6
0 6
1 6
2 4
0 0
0 4
2 5
5 6
4 5
4 5
0 1
3 6
1 6
0 6
0 5
4 5
1 2
0 3
1 2
0 6
2 5...

output:

71432089700

result:

ok single line: '71432089700'

Test #13:

score: 0
Accepted
time: 8ms
memory: 3780kb

input:

3000 8 1
3 5
2 4
1 7
3 3
0 4
3 4
2 4
1 3
4 5
0 0
1 4
2 2
2 6
1 7
1 7
0 7
0 2
0 6
1 7
4 6
0 2
0 7
0 2
6 7
0 7
1 5
1 7
0 6
0 7
4 7
0 7
5 6
1 7
1 2
1 3
2 6
0 3
1 5
2 7
1 7
2 3
0 7
2 5
3 7
2 7
7 7
2 5
2 4
0 6
1 5
0 1
0 5
0 7
6 6
1 4
3 6
0 6
3 4
1 5
6 7
0 7
1 5
4 7
1 3
7 7
1 7
0 4
1 7
1 7
1 5
3 7
0 7
1 7...

output:

89022157300

result:

ok single line: '89022157300'

Test #14:

score: 0
Accepted
time: 8ms
memory: 3976kb

input:

3000 9 1
1 8
0 3
1 7
3 7
2 7
0 8
1 8
3 8
0 8
2 3
2 7
1 7
0 5
0 8
3 7
1 5
0 8
4 4
1 7
6 6
5 6
3 4
1 4
1 7
0 8
0 6
5 8
0 0
0 7
1 3
1 7
2 5
1 4
1 7
4 7
0 8
0 8
1 8
0 7
4 8
3 8
0 8
0 8
0 6
0 8
2 3
2 8
2 7
2 7
0 8
2 3
0 3
3 7
2 5
0 8
1 4
1 4
2 6
3 6
3 6
6 8
2 7
3 8
1 3
0 8
2 6
3 7
2 6
0 4
1 8
4 8
0 6
1 8...

output:

379045773469

result:

ok single line: '379045773469'

Test #15:

score: 0
Accepted
time: 8ms
memory: 3716kb

input:

3000 10 1
3 6
6 9
3 9
0 8
0 4
0 8
4 9
4 5
0 4
6 6
0 8
2 6
4 7
0 6
0 8
4 4
3 8
0 4
9 9
5 9
0 8
1 4
0 3
0 8
3 5
0 4
3 9
4 7
0 9
0 8
1 3
2 4
0 7
4 5
0 6
7 8
0 4
9 9
0 8
1 6
5 5
3 9
1 8
1 8
0 2
2 2
3 9
2 3
4 4
1 7
3 7
2 3
2 9
6 9
1 4
1 7
1 2
6 6
4 5
2 7
4 9
4 6
2 6
1 5
7 8
1 4
3 7
6 6
4 9
9 9
3 7
1 2
0 ...

output:

331629106039

result:

ok single line: '331629106039'

Test #16:

score: 0
Accepted
time: 12ms
memory: 3992kb

input:

3000 2934 1
1970 2832
110 2030
61 2595
313 2018
546 1871
1131 2583
216 2779
909 1996
864 1914
1011 1315
1365 2599
508 1996
955 2087
310 1272
1955 2337
781 1719
155 815
837 1681
25 2913
841 1953
376 2752
388 1124
1099 2382
1323 2198
851 2217
1459 2721
465 2160
312 2250
55 1080
180 339
764 2865
82 253...

output:

2426370144

result:

ok single line: '2426370144'

Test #17:

score: 0
Accepted
time: 9ms
memory: 3792kb

input:

2942 3000 1
425 2447
791 893
243 2737
447 1479
1447 2468
181 2810
1219 2995
2407 2628
296 1770
1535 1779
1338 2418
441 1346
1916 2767
740 2628
4 1462
230 2239
1755 1880
33 2815
283 2054
922 1731
1236 2809
513 2469
190 2711
1692 1850
31 2959
369 1998
246 2694
2524 2867
1076 2822
1204 2795
153 1294
28...

output:

3475348346

result:

ok single line: '3475348346'

Test #18:

score: 0
Accepted
time: 10ms
memory: 3812kb

input:

3000 3000 1
1390 1947
533 1520
288 2002
824 1075
363 2519
1187 2858
532 2977
31 2120
1 2937
1545 2305
1125 2756
835 2017
2055 2309
1621 2143
1316 1826
244 2875
1299 2494
509 2480
1384 1735
23 2976
443 752
290 993
495 2557
484 2973
718 1717
20 2576
470 1167
25 2557
157 2901
360 2798
1488 1917
719 294...

output:

1096040253

result:

ok single line: '1096040253'

Test #19:

score: 0
Accepted
time: 13ms
memory: 3908kb

input:

3000 11 1
6 10
3 10
0 6
0 10
0 8
2 10
4 10
0 7
0 3
0 10
0 7
0 1
4 10
0 2
7 10
0 10
0 10
1 10
2 10
9 10
9 10
8 10
10 10
0 2
0 5
7 10
0 1
0 2
8 10
0 10
0 10
0 10
0 6
9 10
5 10
0 7
0 10
0 2
0 7
4 10
6 10
0 3
0 1
6 10
3 10
4 10
7 10
2 10
0 9
10 10
0 2
8 10
3 10
9 10
0 9
5 10
0 5
4 10
0 6
0 10
0 10
10 10...

output:

231189542188

result:

ok single line: '231189542188'

Test #20:

score: 0
Accepted
time: 12ms
memory: 3948kb

input:

3000 12 1
1 11
0 9
3 11
0 10
0 0
1 11
0 11
0 1
0 0
0 6
4 11
2 11
0 0
8 11
2 11
0 5
0 11
0 5
0 9
0 9
3 11
10 11
0 1
6 11
0 6
6 11
0 2
0 3
11 11
6 11
3 11
7 11
5 11
5 11
0 9
6 11
0 0
0 10
0 1
0 2
2 11
6 11
0 1
1 11
10 11
3 11
0 4
7 11
0 1
0 0
0 9
5 11
5 11
8 11
0 9
0 1
6 11
1 11
9 11
9 11
0 0
7 11
0 5...

output:

149422997346

result:

ok single line: '149422997346'

Test #21:

score: 0
Accepted
time: 15ms
memory: 3684kb

input:

3000 13 1
6 12
0 1
4 12
0 2
4 12
0 12
1 12
3 12
11 12
0 11
10 12
9 12
0 6
0 4
9 12
1 12
0 11
0 12
10 12
5 12
0 8
11 12
2 12
0 12
7 12
0 10
4 12
11 12
0 8
0 12
6 12
0 2
0 6
4 12
5 12
4 12
0 7
1 12
0 2
3 12
9 12
9 12
4 12
0 12
8 12
0 4
0 7
4 12
10 12
0 1
0 2
12 12
7 12
4 12
0 5
0 3
0 9
0 1
0 11
6 12
0...

output:

193191161451

result:

ok single line: '193191161451'

Test #22:

score: 0
Accepted
time: 35ms
memory: 3696kb

input:

3000 3000 1
0 557
0 987
0 1714
0 251
843 2999
0 1671
0 2445
910 2999
63 2999
2239 2999
0 1631
1817 2999
2745 2999
2477 2999
0 510
0 2631
0 1195
1028 2999
0 351
0 2953
2690 2999
0 703
937 2999
0 2489
2000 2999
0 2556
0 697
467 2999
255 2999
0 2438
2570 2999
777 2999
0 964
0 1963
1344 2999
0 1766
2199...

output:

210328057904

result:

ok single line: '210328057904'

Test #23:

score: 0
Accepted
time: 44ms
memory: 3996kb

input:

3000 2983 1
0 133
2599 2982
2541 2982
0 389
0 2825
0 432
561 2982
2514 2982
0 1865
0 706
720 2982
3 2982
1648 2982
0 1731
1890 2982
1570 2982
0 937
1853 2982
0 1418
687 2982
0 799
1530 2982
1446 2982
2216 2982
0 2047
0 2530
0 2971
0 1736
1767 2982
0 1447
0 47
601 2982
0 1758
84 2982
0 2756
0 2116
0 ...

output:

571590929028

result:

ok single line: '571590929028'

Test #24:

score: 0
Accepted
time: 39ms
memory: 3640kb

input:

2984 3000 1
0 1161
1028 2999
0 2476
0 2636
0 1914
0 776
0 2136
248 2999
0 48
2645 2999
0 829
2998 2999
359 2999
0 1766
0 927
2847 2999
1471 2999
0 1945
188 2999
295 2999
1426 2999
1831 2999
697 2999
1280 2999
0 1876
735 2999
0 1413
2326 2999
0 2970
537 2999
1249 2999
1147 2999
0 1827
0 943
0 213
0 1...

output:

472133773188

result:

ok single line: '472133773188'

Test #25:

score: 0
Accepted
time: 2ms
memory: 3680kb

input:

300 3000 1
2218 2999
2936 2999
2708 2999
2281 2999
0 1722
0 1888
0 1064
0 704
1925 2999
0 1753
2426 2999
0 1862
0 1830
572 2999
0 2435
798 2999
95 2999
1193 2999
507 2999
0 1299
0 2105
0 508
2672 2999
1956 2999
1742 2999
0 2278
0 118
586 2999
1966 2999
0 1101
77 2999
2768 2999
1755 2999
0 81
0 1013
...

output:

54180869583

result:

ok single line: '54180869583'

Test #26:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

102 3000 1
0 689
840 2999
1957 2999
0 1676
0 415
2411 2999
2855 2999
2582 2999
0 2096
2287 2999
1961 2999
0 1601
2643 2999
1220 2999
820 2999
0 1470
802 2999
392 2999
0 1762
1064 2999
2595 2999
0 748
1501 2999
0 991
0 617
0 1021
0 1598
1753 2999
0 717
0 2553
1705 2999
0 646
0 106
109 2999
0 2738
284...

output:

1972426860

result:

ok single line: '1972426860'

Test #27:

score: 0
Accepted
time: 0ms
memory: 3508kb

input:

30 3000 1
0 6
2934 2999
419 2999
0 2107
0 2694
0 1094
0 714
2652 2999
0 166
0 1841
0 1480
654 2999
922 2999
503 2999
0 1267
0 680
0 2078
0 815
1096 2999
417 2999
2967 2999
764 2999
0 585
0 703
0 2031
1558 2999
1048 2999
893 2999
0 551
0 2839
997165834 387960850

output:

4100852634

result:

ok single line: '4100852634'

Test #28:

score: 0
Accepted
time: 12ms
memory: 3800kb

input:

3000 3000 1
2 2888
284 2922
152 2772
112 2784
140 2943
32 2566
262 2972
67 2987
97 2809
69 2766
282 2975
411 2876
515 2970
66 2929
240 2686
357 2972
22 2884
27 2627
139 2776
108 2593
401 2822
26 2988
61 2845
154 2847
101 2961
80 2756
56 2833
15 2750
118 2661
130 2870
132 2799
369 2815
32 2570
252 27...

output:

4441208350

result:

ok single line: '4441208350'

Test #29:

score: 0
Accepted
time: 12ms
memory: 3920kb

input:

3000 2998 1
0 2979
109 2505
172 2990
313 2748
175 2591
167 2968
284 2698
24 2815
107 2604
34 2965
123 2877
25 2992
75 2989
38 2836
286 2960
308 2919
393 2797
1 2533
350 2969
442 2864
170 2994
57 2749
75 2846
235 2967
180 2712
135 2883
307 2871
34 2556
463 2873
352 2984
111 2721
191 2827
193 2953
51 ...

output:

707002430

result:

ok single line: '707002430'

Test #30:

score: 0
Accepted
time: 12ms
memory: 3800kb

input:

2983 3000 1
287 2693
86 2847
39 2840
24 2998
132 2547
70 2707
166 2884
168 2850
17 2994
18 2863
60 2490
164 2746
59 2806
0 2991
236 2799
189 2682
224 2705
55 2742
105 2848
131 2954
39 2975
51 2672
55 2970
108 2972
30 2539
24 2991
39 2863
193 2987
135 2838
0 2998
6 2827
349 2934
24 2618
51 2911
131 2...

output:

5259263969

result:

ok single line: '5259263969'

Subtask #2:

score: 0
Wrong Answer

Dependency #1:

100%
Accepted

Test #31:

score: 22
Accepted
time: 1ms
memory: 3888kb

input:

500 1000000000 1
393977 997870502
1756198 996576675
709934 998910119
17244831 952957551
142872155 968927704
30385278 942410694
85734427 939378703
37926488 882420546
46151590 899775163
85788461 920969935
45003485 970828908
67012830 999694016
121553395 948429920
74733065 879692791
28285744 997261133
1...

output:

0

result:

ok single line: '0'

Test #32:

score: 0
Accepted
time: 1ms
memory: 3836kb

input:

500 1000000000 2
43974519 920435977
29442239 968626496
87296121 970680158
115030899 942979681
14500557 998008395
13920627 941658606
21697984 918354277
21474824 989173405
113175676 946584338
91193449 991632398
117741332 950425500
4841945 986925809
6561290 979837435
37960710 882087904
130890586 960747...

output:

0
0

result:

ok 2 lines

Test #33:

score: 0
Accepted
time: 1ms
memory: 3820kb

input:

500 1000000000 3
65079298 915492964
12721407 929152574
11143804 946828564
63005431 983190275
111727058 957719910
64261942 997647034
2661138 932263997
32904956 851658462
103914205 979192101
34972635 905701784
141650874 943277934
28280148 964799414
28578426 948254190
56473371 939768033
210584 98591566...

output:

0
0
0

result:

ok 3 lines

Test #34:

score: -22
Wrong Answer
time: 43ms
memory: 3892kb

input:

10000 10 50
2 8
1 8
2 9
0 5
1 2
5 6
3 8
1 5
5 8
0 9
0 8
1 9
1 4
0 9
0 5
4 9
3 8
0 0
0 7
2 2
3 6
3 7
3 4
2 9
0 9
4 4
3 5
3 3
1 8
1 1
1 8
0 8
1 6
4 9
3 8
1 7
0 9
0 1
6 7
0 9
7 8
0 9
0 2
2 8
0 7
2 9
1 5
0 9
4 6
0 9
0 9
3 9
0 7
7 7
1 3
7 7
4 8
2 2
5 9
0 5
0 8
1 9
5 7
0 4
8 8
7 9
2 5
0 0
4 8
0 9
0 0
1 5
...

output:

1649863551856
1380493275351
1295735155923
456578775016
269155165802
2011614159399
1892104544432
2780448027
361549026140
2209229746705
1681910746040
2032120266616
1669809044383
109490055677
128024603685
1030140493987
1259667253169
1189990827451
715960613154
700481506423
2274746221202
785728954942
100...

result:

wrong answer 8th lines differ - expected: '54016244655', found: '2780448027'

Subtask #3:

score: 0
Wrong Answer

Test #60:

score: 19
Accepted
time: 75ms
memory: 11908kb

input:

500 10 1000000
2 9
2 7
3 6
1 6
3 5
0 5
3 4
6 8
4 8
1 6
1 5
6 7
7 7
6 9
0 7
4 5
0 6
0 2
4 6
0 6
1 7
2 8
0 9
0 9
0 9
0 7
3 6
8 8
2 4
4 4
0 5
2 5
1 6
0 9
2 7
0 8
9 9
1 4
0 9
2 4
1 9
2 8
2 6
0 4
5 9
4 5
3 9
2 6
1 9
0 6
6 8
2 9
4 9
7 9
2 7
1 5
1 8
0 6
0 9
2 9
3 9
0 2
4 4
5 9
4 7
8 9
4 9
1 8
3 8
2 9
6 6
3...

output:

109125435050
79679504214
40397444309
33486843995
50549382350
8831039674
29373662236
35916635082
1627822212
83193326242
7021463069
18347246004
17908310304
40111838606
42807634739
83808922569
36682521996
87471336298
56912099994
74488880562
59044328919
71779759293
47086282044
46402519236
10235901992
55...

result:

ok 1000000 lines

Test #61:

score: 0
Accepted
time: 84ms
memory: 11932kb

input:

500 10 1000000
2 3
0 5
4 8
5 9
1 3
3 8
0 1
3 8
2 8
2 9
1 3
3 3
1 8
5 9
3 9
4 5
6 9
2 9
2 3
0 8
2 9
0 3
1 9
9 9
2 9
2 7
2 8
2 4
6 9
2 9
0 9
2 8
2 8
0 4
2 6
7 8
0 9
0 8
0 9
2 7
5 7
4 7
0 9
5 6
0 4
2 7
0 7
2 9
2 8
0 2
1 6
0 9
1 6
0 7
7 9
0 8
4 9
1 5
0 9
1 7
0 2
4 8
2 2
5 5
4 8
3 7
8 8
1 5
9 9
0 8
4 4
0...

output:

93932220045
43423248548
63878537436
19958848316
34458591915
74471642637
29392721565
108979131384
68348696934
50344204576
86393681343
95187505608
59870044263
83702649696
40342598040
43679949188
38834691528
68528731476
73704081803
21220971702
17051904446
74680125785
33411395765
34066852792
84600145110...

result:

ok 1000000 lines

Test #62:

score: -19
Wrong Answer
time: 85ms
memory: 12136kb

input:

500 10 1000000
0 9
0 9
1 9
1 9
2 9
0 8
5 7
0 8
6 9
0 5
3 6
1 8
4 8
0 6
1 3
3 3
3 7
0 9
2 3
6 7
0 4
3 9
2 8
7 9
4 5
6 9
8 9
2 6
5 8
5 7
1 1
0 5
0 9
0 1
4 8
0 9
3 8
2 9
3 8
0 8
5 8
0 9
0 8
2 5
0 9
5 8
5 9
2 3
6 8
0 6
2 4
5 7
5 8
2 9
0 7
1 8
0 9
6 8
3 7
0 5
0 7
3 5
1 8
2 8
0 8
7 9
7 9
2 2
0 9
1 8
5 5
5...

output:

57026961526
17848690951
99635443948
24983590233
44471894109
48040845836
78801683211
92617033538
95131564360
76003932078
1954677732
104824016509
83455743908
78148882789
31398746199
56921062405
8610055861
12034412595
76850763508
52731113665
57708287054
70697847727
42403292275
24664520532
110883680880
...

result:

wrong answer 11th lines differ - expected: '4524951945', found: '1954677732'

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%