QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#321733#6390. InspectionsKKT89100 ✓256ms29832kbC++172.6kb2024-02-05 11:04:152024-02-05 11:04:16

Judging History

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

  • [2024-02-05 11:04:16]
  • 评测
  • 测评结果:100
  • 用时:256ms
  • 内存:29832kb
  • [2024-02-05 11:04:15]
  • 提交

answer

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) { return (ull)rng() % B; }

// https://www.acmicpc.net/problem/28496
template <typename T> struct RangeUpdateSet {
    // [l, r] の閉区間と id(非負整数値) を保持する
    // 内部実装での保持順は左右逆になっていることに注意
    using Seg = tuple<T, T, int>;
    RangeUpdateSet() : count(0) {}

    void add(T l, T r, int idx = -1) {
        if (l <= r) {
            if (idx == -1) idx = count++;
            st.insert({r, l, idx});
        }
    }

    // [l, r] と重なる部分を削除し、その区間を返す
    // 返り値の id = -1 の時、該当する区間がないということ
    // id = -1 が返ってくるまで while ループを回す使い方を想定
    Seg update(T l, T r) {
        auto it = st.lower_bound(Seg{l, inf, -1});
        if (it == st.end()) return Seg(0, 0, -1);
        auto [dr, dl, id] = *it;
        if (dl > r) return Seg(0, 0, -1);

        st.erase(it);
        if (dl < l) add(dl, l - 1, id);
        if (r < dr) add(r + 1, dr, id);
        return Seg(max(l, dl), min(r, dr), id);
    }

    void dump() {
        cerr << "-----RangeUpdateSet-----" << endl;
        for (auto [r, l, id] : st) {
            cerr << l << " " << r << " " << id << endl;
        }
    }

  private:
    const T inf = numeric_limits<T>::min();
    set<Seg> st;
    int count;
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    RangeUpdateSet<int> S;
    int n, m, q;
    cin >> n >> m >> q;
    using P = pair<ll, ll>;
    vector<int> L(m), R(m);
    vector<ll> tm(m + 1);

    vector<P> v;
    for (int i = 0; i < m; i++) {
        cin >> L[i] >> R[i];
        tm[i + 1] = tm[i] + (R[i] - L[i] + 1);
        while (true) {
            auto [l, r, id] = S.update(L[i], R[i]);
            if (id == -1) break;
            ll v1 = tm[id] + (l - L[id]);
            ll v2 = tm[i] + (l - L[i]);
            v.push_back({v2 - v1, r - l + 1});
        }
        S.add(L[i], R[i], i);
    }
    sort(v.begin(), v.end());
    v.push_back({1e18, 0});
    for (int i = v.size() - 1; i > 0; i--) {
        v[i - 1].second += v[i].second;
    }

    for (int i = 0; i < q; i++) {
        ll x;
        cin >> x;
        cout << lower_bound(v.begin(), v.end(), pair<ll, ll>{x + 1, -1})->second << " ";
    }
    cout << endl;
}

详细

Subtask #1:

score: 11
Accepted

Test #1:

score: 11
Accepted
time: 0ms
memory: 3844kb

input:

20 20 10
3 16
8 17
17 18
6 16
7 7
3 19
8 13
4 15
5 7
1 18
17 18
3 13
1 10
6 10
2 8
11 18
1 14
9 18
3 16
4 15
8 2 17 19 12 15 7 17 4 3

output:

150 165 64 40 122 79 150 64 165 165 

result:

ok single line: '150 165 64 40 122 79 150 64 165 165 '

Test #2:

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

input:

200 200 200
30 198
22 155
10 175
113 178
48 70
12 39
139 189
162 183
128 164
153 181
29 81
48 153
87 163
45 71
47 125
25 118
68 76
43 102
160 179
33 129
18 95
74 122
66 124
180 193
81 198
151 152
94 113
66 121
165 199
25 118
45 195
4 161
41 176
129 163
16 58
50 171
168 177
171 198
134 194
54 120
56 ...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #3:

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

input:

200 200 200
179 197
137 140
14 56
101 189
48 188
4 150
55 104
57 65
46 141
172 173
15 144
134 179
28 147
76 175
109 189
43 189
46 100
31 83
57 118
91 159
19 116
6 58
101 190
91 100
142 167
135 162
28 59
133 143
42 150
16 188
105 157
106 192
13 22
184 197
31 184
47 122
75 84
150 159
8 166
70 70
51 13...

output:

1 1 1 9 0 1648 0 8364 0 1 0 0 0 0 0 2 2 0 23 0 2 9 0 5 0 0 216 5 0 9 0 0 0 0 0 0 2 5 9 2 0 0 6 0 0 1 0 1 0 6 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 2 0 0 52 0 418 0 449 0 0 0 0 0 0 2 0 0 0 0 0 1 0 0 1 0 0 1 9476 2 5607 0 1 6 0 1 2 0 0 0 47 0 2 0 1 5 0 0 0 0 0 117 90 0 1 0 90 5 1 5 0 17 0 0 0 47 0 2 207 13099...

result:

ok single line: '1 1 1 9 0 1648 0 8364 0 1 0 0 ...0 30 6 1 0 0 2 6 0 0 0 0 0 0 0 '

Test #4:

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

input:

200 200 200
1 2
3 17
18 22
23 27
28 40
41 75
76 84
85 86
87 111
112 118
119 123
124 134
135 156
157 166
167 174
175 175
176 199
200 200
1 6
7 14
15 74
75 76
77 83
84 90
91 102
103 116
117 117
118 120
121 123
124 131
132 162
163 166
167 178
179 192
193 200
1 7
8 9
10 39
40 43
44 59
60 82
83 86
87 90
...

output:

1748 1748 0 0 0 1748 0 0 1748 1748 0 0 0 1748 0 1748 1748 0 0 0 1748 1748 0 0 1748 1748 0 0 1748 0 1748 1748 1748 0 0 1748 0 1748 1748 1748 1748 1748 0 0 0 1748 1748 1748 0 0 0 1748 0 1748 1748 1748 1748 0 1748 0 1748 1748 1748 1748 1748 0 1748 1748 1748 0 1748 1748 1748 0 1748 0 1748 0 1748 1748 0 ...

result:

ok single line: '1748 1748 0 0 0 1748 0 0 1748 ...748 0 0 0 1748 1748 0 1748 0 0 '

Test #5:

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

input:

200 200 200
1 200
8 190
9 186
16 184
32 173
40 152
61 127
89 89
1 200
8 188
11 176
19 173
20 167
28 165
30 161
31 141
32 132
38 131
39 129
59 99
63 89
66 86
72 72
1 200
14 183
32 166
48 138
51 133
99 112
101 108
103 103
1 200
5 184
19 175
25 170
62 148
80 124
104 113
110 110
1 200
5 186
19 185
24 18...

output:

0 308 0 0 0 0 0 0 0 0 0 516 79 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 222 0 0 0 0 0 0 0 0 0 0 0 0 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2058 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1435 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

result:

ok single line: '0 308 0 0 0 0 0 0 0 0 0 516 79... 236 0 0 0 0 0 0 0 0 0 0 0 143 '

Test #6:

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

input:

200 200 200
1 200
64 156
28 60
81 166
65 186
24 87
94 160
86 108
83 157
99 156
32 75
126 164
153 172
55 157
29 69
27 149
34 114
122 143
164 174
55 66
27 160
67 86
30 154
32 34
21 160
77 95
88 176
54 146
66 150
103 178
28 97
22 192
125 175
32 69
45 194
92 176
149 157
54 153
41 85
35 84
59 193
155 191...

output:

31 230 7730 20 24 24 18 24 1533 24 35 36 26 13388 4194 20 24 18 24 36 2799 65 24 391 24 198 825 100 55 39 20 46 825 24 26 126 24 20 20 20 24 20 55 52 121 20 26 288 24 20 20 270 1252 1420 24 24 24 35 13988 79 24 26 24 38 20 24 20 21 501 24 825 21 31 288 685 1420 24 20 13033 20 36 20 20 695 24 31 501 ...

result:

ok single line: '31 230 7730 20 24 24 18 24 153...14633 26 24 101 24 24 24 20 20 '

Test #7:

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

input:

200 200 200
1 197
1 179
1 140
1 137
1 56
1 14
1 189
1 101
1 188
1 48
1 4
1 150
1 55
1 104
1 57
1 65
1 46
1 141
1 173
1 172
1 144
1 15
1 134
1 179
1 147
1 28
1 175
1 76
1 109
1 189
1 189
1 43
1 100
1 46
1 83
1 31
1 118
1 57
1 159
1 91
1 19
1 116
1 58
1 6
1 101
1 190
1 100
1 91
1 167
1 142
1 135
1 162...

output:

22 0 0 0 31 0 0 0 2 32 35 18001 0 0 0 32 0 0 0 0 0 26 34 0 26 0 113 7 0 0 0 0 34 0 32 0 9 16096 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 34 0 19542 0 0 113 33 0 0 0 3569 0 0 0 0 0 0 0 0 0 31 0 33 0 82 0 0 0 0 0 0 214 32 0 0 0 0 0 32 22 187 0 0 0 0 0 0 0 0 32 0 0 0 0 7 0 378 0 0 214 0 0 0 0 9 9 214 478 20372 ...

result:

ok single line: '22 0 0 0 31 0 0 0 2 32 35 1800...1 22 0 0 82 26 91 0 26 0 0 0 9 '

Test #8:

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

input:

98 76 54
1 94
5 18
4 65
18 21
29 72
53 67
62 94
5 45
12 41
20 75
17 40
42 88
8 9
33 60
48 98
37 54
16 93
14 15
68 80
57 92
2 94
3 96
68 97
95 96
38 83
55 81
3 50
24 40
14 31
25 41
49 93
14 80
10 90
41 55
45 82
15 41
39 60
16 89
12 81
2 92
30 50
24 44
81 90
14 54
23 91
48 73
29 31
46 95
18 18
9 69
50...

output:

2425 2369 2442 2407 2284 2084 2442 2407 2379 2369 2379 2327 2455 2393 2464 2449 2455 2455 2379 2274 2442 2464 2464 2464 2305 2379 2425 2369 2379 2155 2274 2455 2464 2284 2393 2464 2425 2455 2442 2284 2379 2284 2464 2211 2284 2464 2393 2455 2442 2369 2393 2455 2425 2369 

result:

ok single line: '2425 2369 2442 2407 2284 2084 ... 2442 2369 2393 2455 2425 2369 '

Test #9:

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

input:

1 1 1
1 1
0

output:

0 

result:

ok single line: '0 '

Test #10:

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

input:

1 1 1
1 1
1000000000000

output:

0 

result:

ok single line: '0 '

Subtask #2:

score: 18
Accepted

Dependency #1:

100%
Accepted

Test #11:

score: 18
Accepted
time: 24ms
memory: 3944kb

input:

2000 2000 200000
909 1547
1182 1944
81 1117
549 958
45 881
662 916
496 1045
1333 1409
796 857
1047 1624
637 1673
745 1642
437 648
1056 1655
205 262
1018 1761
1188 1543
14 950
439 1430
178 1087
59 1907
282 1422
1068 1787
1162 1502
235 1088
1565 1609
452 1151
439 650
1297 1857
470 1912
963 1134
1418 1...

output:

0 0 2 2 0 0 0 2 16 15 1 0 15 2 1 2 0 16 0 0 0 1 4 0 0 0 996 95 0 177 1 0 0 17 2 1 1 1 0 1 0 0 0 2 15 0 0 0 0 0 0 1 0 15 12 673 2 0 0 2 0 16 0 0 0 4 0 0 0 1 0 0 85 1 1 4 1 0 16 2 0 16 2 0 0 1 0 0 1 3591 63 0 1847 1 2 0 0 496 15042 99 2 1 1 95 1 0 0 1 2 0 0 0 4747 1 2 0 2 3 12 1 0 0 0 5 16 0 0 16 0 5 ...

result:

ok single line: '0 0 2 2 0 0 0 2 16 15 1 0 15 2... 0 2 0 1 1 163 0 2 4 4 2 5 177 '

Test #12:

score: 0
Accepted
time: 20ms
memory: 3728kb

input:

2000 2000 200000
1 62
63 98
99 130
131 133
134 144
145 147
148 171
172 190
191 194
195 219
220 246
247 257
258 346
347 352
353 361
362 365
366 431
432 473
474 529
530 535
536 541
542 551
552 571
572 589
590 600
601 640
641 684
685 689
690 692
693 727
728 748
749 780
781 809
810 818
819 859
860 880
8...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 54364 '

Test #13:

score: 0
Accepted
time: 24ms
memory: 3764kb

input:

2000 2000 200000
1 2000
100 1977
114 1950
131 1938
167 1936
213 1910
226 1889
256 1800
303 1786
326 1762
362 1727
384 1718
394 1677
400 1472
419 1454
461 1446
478 1365
515 1320
527 1270
628 1230
653 1219
704 1210
739 1208
755 1141
779 1085
804 1056
831 1055
892 1019
973 996
975 975
1 2000
10 1987
16...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 511 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2787 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5238 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #14:

score: 0
Accepted
time: 27ms
memory: 4052kb

input:

2000 2000 200000
1 2000
2 1999
3 1998
4 1997
5 1996
6 1995
7 1994
8 1993
9 1992
10 1991
11 1990
12 1989
13 1988
14 1987
15 1986
16 1985
17 1984
18 1983
19 1982
20 1981
21 1980
22 1979
23 1978
24 1977
25 1976
26 1975
27 1974
28 1973
29 1972
30 1971
31 1970
32 1969
33 1968
34 1967
35 1966
36 1965
37 1...

output:

1306 0 264 0 634 676 944 0 0 600 0 186 1274 1234 0 614 1144 558 468 0 0 0 180 0 82 914 882 0 0 886 108 1720 586 24 0 826 154 0 558 0 0 0 986 1332 1390 0 128 60 58 0 0 0 1558 0 0 0 0 1298 422 0 0 0 0 0 340 458 896 0 740 638 0 0 0 496 1106 788 0 1658 1066 0 196 0 124 0 774 1152 202 0 0 42 0 0 1208 0 0...

result:

ok single line: '1306 0 264 0 634 676 944 0 0 6... 0 566 0 0 856 0 192 508 0 0 0 '

Test #15:

score: 0
Accepted
time: 22ms
memory: 3988kb

input:

2000 2000 200000
1663 1741
549 634
566 666
1200 1298
1945 1987
1314 1402
1196 1251
1322 1410
1304 1352
1691 1739
1625 1708
1307 1382
625 666
1637 1737
35 129
375 420
1512 1607
373 435
1917 1976
1300 1377
355 428
1712 1767
926 1015
1750 1839
1063 1157
635 686
954 1012
35 76
681 747
1882 1973
1383 146...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #16:

score: 0
Accepted
time: 23ms
memory: 3728kb

input:

2000 2000 200000
1 909
1 1547
1 1944
1 1182
1 81
1 1117
1 958
1 549
1 45
1 881
1 662
1 916
1 496
1 1045
1 1333
1 1409
1 857
1 796
1 1047
1 1624
1 637
1 1673
1 1642
1 745
1 437
1 648
1 1056
1 1655
1 205
1 262
1 1761
1 1018
1 1543
1 1188
1 950
1 14
1 1430
1 439
1 1087
1 178
1 1907
1 59
1 1422
1 282
1 ...

output:

0 752 0 0 0 355 0 0 0 1445 4776 21 0 28 0 0 21 28 0 0 9 0 0 0 135 0 0 0 9 0 0 0 0 0 0 0 0 0 0 0 0 39 0 0 60 1178 0 0 0 0 0 28 28 0 0 650 0 0 2 0 0 0 0 0 0 135 0 0 0 0 0 0 0 0 0 0 437 0 0 0 0 2 9 0 3684 0 0 0 0 0 28 39 0 82 0 0 28 84853 0 0 0 0 0 9 21 0 0 0 28 0 28 0 0 26 0 135 0 39 0 0 26 0 0 0 0 0 ...

result:

ok single line: '0 752 0 0 0 355 0 0 0 1445 477...0 0 21 0 0 0 0 0 444 0 0 0 0 0 '

Test #17:

score: 0
Accepted
time: 27ms
memory: 3784kb

input:

1999 1999 199999
176 370
472 632
887 936
1492 1965
662 1998
1022 1276
649 711
726 1660
1617 1788
407 1052
1024 1074
1169 1188
1366 1969
53 881
1548 1887
767 1562
1201 1309
1164 1997
474 1105
492 1499
730 871
660 1724
293 1722
1065 1147
419 1817
1160 1323
939 1454
303 1050
326 465
91 1383
212 379
976...

output:

563 2684 2192 104417 828 288 600 1817 453 2466 89369 5541 203 3331 437 828 392 5351 400 193 426 1235 1170 2382 2811 1272 143260 506 1170 193 5149 426 593 811 587 563 437 5351 963 7720 3375 193 453 262 2466 48503 600 1077 392 73855 453 219423 476 5829 203 587 229 400 563 852 326 193 437 437 669488 11...

result:

ok single line: '563 2684 2192 104417 828 288 6...7 31255 563 3078 593 21030 426 '

Subtask #3:

score: 22
Accepted

Test #18:

score: 22
Accepted
time: 25ms
memory: 3976kb

input:

200000 2000 200000
1 120424
1 117468
1 120525
1 165913
1 120671
1 173649
1 177086
1 160439
1 113657
1 1024
1 172987
1 46445
1 141508
1 72552
1 166171
1 71764
1 129090
1 59615
1 157163
1 44185
1 24107
1 127434
1 157165
1 64831
1 2536
1 138854
1 96084
1 11803
1 162841
1 171842
1 116681
1 47063
1 65296...

output:

319 15786 0 319 185 185 0 4039 0 0 185 319 0 0 0 4039 8795 67453 0 1512 92833 0 0 0 4039 319 185 4039 319 0 0 0 7942 0 185 4039 0 9712 106625656 0 319 6437294 0 185 185 0 0 319 0 1448 1512 185 319 185 0 185 0 185 7169 0 319 0 185 1159434 37373 0 5258 185 0 0 1448 185 185 4039 0 0 0 0 0 0 0 185 0 0 3...

result:

ok single line: '319 15786 0 319 185 185 0 4039... 0 185 0 319 140410 0 185 4039 '

Test #19:

score: 0
Accepted
time: 97ms
memory: 15496kb

input:

200000 200000 200000
1 105714
1 114613
1 25850
1 174511
1 149627
1 40719
1 49551
1 191246
1 49695
1 198423
1 77938
1 133429
1 174342
1 62669
1 19363
1 197263
1 156780
1 133160
1 29943
1 40314
1 7392
1 194703
1 190490
1 151626
1 176326
1 95967
1 175303
1 95044
1 191766
1 182184
1 194258
1 100
1 50906...

output:

4586223 33661520 16925905 51985467 16647357 5094706 13109049 7655073 20948877 63669511 131684346 8135711 3921928 18323346 6482011 4382470 10899030 21564402 10179375 330483347 16332910 40520087 3896118 22405319 5029442 17733161 42118334 15139106949 5517728 7162073 7212437 47546550 93373206 35061660 4...

result:

ok single line: '4586223 33661520 16925905 5198...584532 6394862 3896118 6400722 '

Test #20:

score: 0
Accepted
time: 87ms
memory: 16140kb

input:

200000 200000 200000
1 84862
1 12038
1 107534
1 84884
1 96770
1 142873
1 169266
1 195872
1 107699
1 145577
1 91921
1 97397
1 163387
1 107808
1 105150
1 33461
1 54326
1 139773
1 174400
1 188441
1 58484
1 67025
1 173458
1 73452
1 34682
1 68801
1 163681
1 134541
1 174529
1 103559
1 158417
1 90482
1 152...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #21:

score: 0
Accepted
time: 81ms
memory: 10272kb

input:

178965 126789 200000
1 155452
1 63409
1 175449
1 173598
1 75512
1 8798
1 101953
1 49531
1 4116
1 72091
1 14404
1 42765
1 114994
1 19243
1 129660
1 57049
1 78438
1 134388
1 98557
1 111950
1 150571
1 167878
1 57531
1 99845
1 145445
1 19371
1 89794
1 143698
1 141739
1 127541
1 61405
1 144152
1 35780
1 ...

output:

11261189812 8447657723 11278055648 11076886083 8983120810 11251543830 10869429837 11141595077 9981744869 11027818562 9393263392 10018022956 10849648971 9664962370 8256449465 8910804964 10159346867 8643010478 11294700519 10100670752 11273638022 10120052702 10169142476 10575075573 9610345824 102271814...

result:

ok single line: '11261189812 8447657723 1127805...843016 11318989179 10641622054 '

Subtask #4:

score: 26
Accepted

Dependency #2:

100%
Accepted

Test #22:

score: 26
Accepted
time: 33ms
memory: 4024kb

input:

200000 2000 200000
97795 145520
101269 124485
53771 68814
23212 162251
45825 153761
11030 59657
87515 137868
60290 102873
83504 185524
111355 164515
159961 180521
161246 163305
45884 171348
12815 130438
30820 132129
27410 172195
77563 121798
41889 117594
5261 78335
53360 154097
115777 135889
35685 4...

output:

2169693 115840238 12498060 12501803 1644547 7122193 110156705 78958301 131042884 10063899 3075847 2320657 5760253 15906653 130746438 31151310 17285650 2807279 2744711 4531290 43697179 20830930 10351467 16202413 2066324 2337675 4849350 4294585 2754610 45983541 2864123 2320657 1679743 1867813 5760253 ...

result:

ok single line: '2169693 115840238 12498060 125...78613 5506668 17271274 6408526 '

Test #23:

score: 0
Accepted
time: 22ms
memory: 3736kb

input:

200000 2000 200000
1 15973
15974 28492
28493 37174
37175 41410
41411 44200
44201 45895
45896 47621
47622 56688
56689 58641
58642 59193
59194 68683
68684 69673
69674 71098
71099 83029
83030 84246
84247 84705
84706 87975
87976 90961
90962 95118
95119 97117
97118 97337
97338 101727
101728 106842
106843...

output:

5826415 0 5826415 5826415 0 0 0 5826415 0 0 5826415 0 0 5826415 5826415 0 0 0 0 0 5826415 5826415 0 0 0 0 5826415 5826415 5826415 0 0 0 0 5826415 0 0 0 0 0 5826415 5826415 0 5826415 0 0 0 0 0 5826415 0 5826415 0 0 5826415 0 5826415 5826415 0 0 5826415 0 5826415 0 5826415 0 0 0 5826415 5826415 582641...

result:

ok single line: '5826415 0 5826415 5826415 0 0 ...6415 0 5826415 5826415 5826415 '

Test #24:

score: 0
Accepted
time: 27ms
memory: 3756kb

input:

200000 2000 200000
1 200000
1571 197932
1892 196826
3518 194493
5320 190915
10398 189559
13153 188872
24179 185674
34033 184230
34889 183392
38505 182034
41897 178645
42107 178024
46248 176792
50417 174961
52192 170208
52640 170136
54471 159393
55111 152164
57679 146283
58619 146108
59251 142725
630...

output:

6001198 5651994 6134133 12902384 5691575 191863087 8245128 5981988 7315006 95779448 198695721 6082955 76698682 6765086 8496624 5420535 8764905 9147182 5933378 5567709 5912877 8449861 203243601 6261263 9128980 7739290 194876581 9002470 8057797 8549580 202820080 6714578 8942197 8764905 188638743 87649...

result:

ok single line: '6001198 5651994 6134133 129023...4412 178130490 7802678 8714998 '

Test #25:

score: 0
Accepted
time: 21ms
memory: 4172kb

input:

200000 2000 200000
1 200000
2 199999
3 199998
4 199997
5 199996
6 199995
7 199994
8 199993
9 199992
10 199991
11 199990
12 199989
13 199988
14 199987
15 199986
16 199985
17 199984
18 199983
19 199982
20 199981
21 199980
22 199979
23 199978
24 199977
25 199976
26 199975
27 199974
28 199973
29 199972
...

output:

0 0 0 0 0 0 0 0 0 395802000 0 0 0 0 0 0 0 0 395802000 0 395802000 0 0 0 0 0 0 395802000 395802000 0 0 0 0 0 0 0 0 0 0 395802000 0 0 395802000 0 0 0 0 395802000 0 0 0 0 0 395802000 0 395802000 0 0 395802000 0 0 0 235199328 0 0 0 0 395802000 395802000 0 395802000 395802000 395802000 0 0 395802000 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 395802000 0 ...00 0 0 0 0 0 395802000 0 0 0 0 '

Test #26:

score: 0
Accepted
time: 17ms
memory: 3748kb

input:

200000 2000 200000
49680 49763
37401 37471
137348 137397
19984 20041
161389 161487
107454 107511
90912 90995
128490 128589
182326 182414
87328 87417
166221 166285
158382 158481
114566 114646
125033 125128
141061 141129
177382 177429
89845 89886
61697 61787
107137 107235
185817 185903
198748 198796
3...

output:

0 0 12094 0 0 0 0 0 0 0 13138 0 0 0 0 20685 0 0 0 0 0 0 0 0 0 0 0 36869 0 0 0 16118 0 0 0 32741 0 0 0 11463 0 0 0 0 0 0 0 0 0 0 0 0 0 2172 109 0 0 0 0 0 0 1829 0 0 0 0 0 0 2191 0 0 0 0 0 0 0 0 0 0 19166 0 230 0 12976 0 1173 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12473 11463 0 0 ...

result:

ok single line: '0 0 12094 0 0 0 0 0 0 0 13138 ... 0 0 24644 0 0 0 0 0 0 0 0 0 0 '

Test #27:

score: 0
Accepted
time: 31ms
memory: 3728kb

input:

186759 2000 197235
57907 76005
45879 128700
127172 170656
67686 103416
43041 183784
113293 179126
36923 43586
85850 146589
44802 180513
92674 102947
5263 15270
55254 99137
4406 105450
125046 127082
50724 158345
38839 184007
9999 47185
25940 82314
120381 156555
125738 145439
103770 112714
34395 51662...

output:

123020143 101895193 120881552 119208628 115762867 122290344 89917091 118900082 119516488 118602668 122961585 91107250 119593292 119813512 91829824 100833720 91829824 118715619 91417465 121938867 98206882 92265813 92465856 118900082 123131261 122974651 94036555 108983652 112946066 112948149 118751377...

result:

ok single line: '123020143 101895193 120881552 ... 110905785 114802089 121921248 '

Subtask #5:

score: 23
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #28:

score: 23
Accepted
time: 177ms
memory: 24236kb

input:

50000 200000 200000
31941 42565
5519 36317
3582 4716
22345 22880
17 42277
11184 33696
21768 28842
3986 46505
7780 39693
25668 48842
25118 28537
21486 41830
1516 39801
33284 35275
2407 33771
18288 32428
14406 31318
19302 21225
42705 47899
24545 32767
15386 28134
24565 45856
23763 34638
22631 46961
15...

output:

555022515 97989675 2140709371 64632343 378638892 432383927 2893640804 126530001 1044102156 3225364525 110354225 165158684 70743489 449742945 317715525 441160843 231652966 115017405 84317098 1780689525 610179282 401746383 82053396 521028954 259063292 699893365 2818335165 510011538 2942566458 97265195...

result:

ok single line: '555022515 97989675 2140709371 ... 3003364354 796526070 65392224 '

Test #29:

score: 0
Accepted
time: 170ms
memory: 24796kb

input:

200000 200000 200000
105714 114613
25850 174511
40719 149627
49551 191246
49695 198423
77938 133429
62669 174342
19363 197263
133160 156780
29943 40314
7392 194703
151626 190490
95967 176326
95044 175303
182184 191766
100 194258
50906 107248
64479 106007
155566 197428
77378 100840
105813 165264
1778...

output:

49490998 1700028413 240616829 17500723 16656195 4772692621 2269413 11053345 5405741 3291158 4034259 3052120 30052267 7722594 27571245 155150598 3352518 2119771 1664938444 5454302 404651666 137954258 7954178 6926687 2094328 253937707 1841490 3029358 10574293 54048002 3052120 13247703 20755833 2323523...

result:

ok single line: '49490998 1700028413 240616829 ...516 4805480 8702638 1294373655 '

Test #30:

score: 0
Accepted
time: 148ms
memory: 23580kb

input:

200000 200000 200000
12038 84862
84884 107534
96770 142873
169266 195872
107699 145577
91921 97397
107808 163387
33461 105150
54326 139773
174400 188441
58484 67025
73452 173458
34682 68801
134541 163681
103559 174529
90482 158417
152694 193009
116857 123296
23993 82720
71860 138466
78814 112843
978...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #31:

score: 0
Accepted
time: 109ms
memory: 16704kb

input:

200000 200000 200000
1 48
49 166
167 282
283 383
384 387
388 439
440 464
465 469
470 502
503 634
635 650
651 693
694 989
990 1069
1070 1108
1109 1123
1124 1182
1183 1241
1242 1347
1348 1381
1382 1386
1387 1600
1601 1988
1989 1990
1991 2023
2024 2134
2135 2267
2268 2326
2327 2363
2364 2394
2395 2443
...

output:

21989865 21989865 0 0 21989865 21989865 0 21989865 21989865 0 0 21989865 21989865 21989865 0 0 21989865 0 21989865 21989865 21989865 0 0 0 0 21989865 0 0 0 21989865 0 21989865 21989865 0 21989865 0 0 0 21989865 0 0 0 21989865 21989865 0 21989865 0 21989865 21989865 0 21989865 21989865 0 21989865 0 2...

result:

ok single line: '21989865 21989865 0 0 21989865...21989865 0 0 21989865 21989865 '

Test #32:

score: 0
Accepted
time: 172ms
memory: 23704kb

input:

200000 200000 200000
1 200000
15 199305
209 199245
358 198690
930 198364
1026 197268
1331 197010
1527 196678
1574 195873
2034 195525
2620 194916
2786 194890
3424 194524
3664 193929
3913 193286
4212 192822
4948 192807
5774 192506
6466 192185
6720 192127
6865 191500
6875 191354
7759 190953
8316 190822...

output:

0 0 0 0 0 0 15654931 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2754214 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 55 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 15654931 0 0 0 0 0... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #33:

score: 0
Accepted
time: 194ms
memory: 29444kb

input:

200000 200000 200000
1 200000
2 199999
3 199995
4 199993
14 199990
16 199989
20 199988
21 199985
23 199984
25 199982
26 199977
31 199973
32 199968
33 199967
34 199965
38 199964
41 199963
42 199961
43 199959
44 199958
46 199954
48 199953
51 199943
52 199942
54 199941
59 199938
66 199935
67 199934
70 ...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1289 0 0 0 0 0 0 0 0 0 529597 213597 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 85783 0 0 0 0 0 0 0 0 0 0 0 0 107466 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 235881 0 0 0 0 0 0...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...0 0 669957 0 0 0 0 0 0 0 0 0 0 '

Test #34:

score: 0
Accepted
time: 200ms
memory: 29832kb

input:

200000 200000 200000
1 200000
4 199995
8 199993
12 199990
15 199988
23 199982
24 199981
29 199980
31 199979
32 199978
33 199977
35 199971
42 199969
44 199967
45 199958
46 199956
48 199954
49 199951
50 199950
54 199949
55 199939
61 199938
64 199937
69 199935
70 199934
75 199933
89 199921
93 199920
94...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #35:

score: 0
Accepted
time: 248ms
memory: 27936kb

input:

200000 200000 200000
1 200000
2 199999
3 199998
4 199997
5 199996
6 199995
7 199994
8 199993
9 199992
10 199991
11 199990
12 199989
13 199988
14 199987
15 199986
16 199985
17 199984
18 199983
19 199982
20 199981
21 199980
22 199979
23 199978
24 199977
25 199976
26 199975
27 199974
28 199973
29 19997...

output:

198956 195206 193996 194368 198466 194384 197440 195302 196162 194574 195448 194852 195730 194010 195832 195418 193816 194764 195014 194334 194576 196992 195444 193950 195508 196124 194816 193852 195418 195102 193848 193824 193982 194566 194782 198866 193950 195502 196434 197866 196412 11406001344 1...

result:

ok single line: '198956 195206 193996 194368 19...06 195814 198440 194982 196112 '

Test #36:

score: 0
Accepted
time: 245ms
memory: 28880kb

input:

200000 200000 200000
1 200000
2 199999
3 199998
4 199997
5 199996
6 199995
7 199994
8 199993
9 199992
10 199991
11 199990
12 199989
13 199988
14 199987
15 199986
16 199985
17 199984
18 199983
19 199982
20 199981
21 199980
22 199979
23 199978
24 199977
25 199976
26 199975
27 199974
28 199973
29 19997...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #37:

score: 0
Accepted
time: 201ms
memory: 23656kb

input:

200000 200000 200000
33475 34545
80447 83307
65030 65682
12137 14627
81306 81844
199738 200000
106543 108624
114299 116167
70538 73462
94218 96512
76480 79096
121753 123112
44415 45416
31854 32651
21830 24174
157026 158231
92392 94697
90018 90653
110030 111086
151217 152702
182065 183692
185380 1860...

output:

80 80 10 10 10 10 35 80 1663 10 107 119 26935601 65 10 24 65 407816 116 10 35 10 664 7160380 80 80 80 729 598163 10 66 10 10 80 10 35 15185 66 24 10 865 35 65 35 2628048 66 10 209 24 65 118 10 66 8829 65 461 65 240 10 35 128 603 10 446 10 290 952896 10 544 80 10 603 80 35 2382 35 35 24 10 10 107 397...

result:

ok single line: '80 80 10 10 10 10 35 80 1663 1...6 10652 80 66 10 66 397 10 153 '

Test #38:

score: 0
Accepted
time: 256ms
memory: 18348kb

input:

200000 200000 200000
145399 145403
2231 2244
20946 20965
103076 103091
198254 198271
185824 185832
30618 30622
113008 113028
91373 91388
85274 85291
46399 46411
24810 24826
66734 66748
75054 75067
112795 112813
151930 151948
45162 45173
114341 114358
171142 171147
181962 181977
189914 189918
73032 7...

output:

109486 1224145 81385 89515 95155 37557 130959 40997 23146 125020 141533 50353 1179918 19576 32618 1181778 40718 398621 1300388 71328 37606 61469 11820 142697 295659 1586050 24233 449898 277621 661533 29132 8940 282046 189858 202501 38773 941499 96788 386204 80559 1162274 34415 786165 96253 470085 18...

result:

ok single line: '109486 1224145 81385 89515 951...8 155688 172104 1413912 671378 '

Test #39:

score: 0
Accepted
time: 244ms
memory: 18552kb

input:

200000 200000 200000
113665 113683
134966 134978
125011 125018
34273 34291
176293 176302
66743 66747
7573 7592
126708 126726
118744 118756
484 494
101300 101305
176490 176498
173191 173202
143355 143363
186750 186768
7136 7149
16287 16298
195384 195390
40256 40271
47731 47734
96461 96477
22808 22822...

output:

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

result:

ok single line: '0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 '

Test #40:

score: 0
Accepted
time: 156ms
memory: 23696kb

input:

200000 200000 200000
1 200000
51581 82159
59322 115460
102539 195027
65425 166190
94332 126062
127338 134355
62450 123525
94167 142899
105561 169729
93986 147401
64705 143181
144598 186458
132138 196025
68818 77849
80129 113187
128271 132679
96664 131345
113383 170644
71099 122963
133915 157970
6427...

output:

50851 50558 50911 51948 50583 50775 50624 51979 50558 51082 50557 50820 27492 10373275 50558 51948 50583 50822 50558 50558 50589 51028 50577 33085 50585 50577 50558 50736 50629 50558 50585 50719 50627 50585 50559 51756 50557 50558 51267 50558 50736 50558 50582 50775 51187 50558 50585 50587 50589 505...

result:

ok single line: '50851 50558 50911 51948 50583 ... 57085 50629 50559 54071 50589 '

Extra Test:

score: 0
Extra Test Passed