QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#875807#2746. Highway TollsWansur100 ✓471ms23836kbC++203.2kb2025-01-30 13:12:282025-01-30 13:12:32

Judging History

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

  • [2025-01-30 13:12:32]
  • 评测
  • 测评结果:100
  • 用时:471ms
  • 内存:23836kb
  • [2025-01-30 13:12:28]
  • 提交

answer

#include "highway.h"
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

const int maxn = 2e5 + 12;

vector<pair<int, int>> g[maxn];
bool is[maxn], si[maxn];
ll d1[maxn], d2[maxn], d[maxn];
ll a, b;
int n, m;
int pos = -1;


vector<array<int, 3>> bfs(int v, ll d[]) {
    vector<array<int, 3>> res;
    for(int i = 0; i < n; i++) {
        if(d[i] >= 0) {
            d[i] = 1e18;
        }
    }

    d[v] = 0;
    queue<int> q;
    q.push(v);
    while(q.size()) {
        int u = q.front();
        q.pop();
        for(auto [to, id] : g[u]) {
            if(id < pos) continue;
            if(d[to] > d[u] + 1) {
                q.push(to);
                d[to] = d[u] + 1;
                res.push_back({u, to, id});
            }
        }
    }

    return res;
}

void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) {
    n = N, m = (int)U.size();
    a = A, b = B;

    for(int i = 0; i < m; i++) {
        g[U[i]].push_back({V[i], i});
        g[V[i]].push_back({U[i], i});
    }

    ll len = ask(vector<int> (m, 0));
    len /= a;
    for(int l = 0, r = m - 1; l <= r;) {
        int mid = (l + r) >> 1;
        vector<int> w(m, 0);
        for(int i = 0; i <= mid; i++) {
            w[i] = 1;
        }
        if(ask(w) > len * a) {
            pos = mid;
            r = mid - 1;
        }
        else l = mid + 1;
    }

    int x = U[pos], y = V[pos];
    bfs(x, d1);
    bfs(y, d2);

    for(int i = 0; i < n; i++) {
        if(d1[i] < d2[i]) {
            is[i] = true;
        }
        if(d2[i] < d1[i]) {
            si[i] = true;
        }
    }

    vector<array<int, 3>> ord, orz;
    for(int i = 0; i < m; i++) {
        if(is[U[i]] && is[V[i]]) {
            if(d1[U[i]] > d1[V[i]]) {
                swap(U[i], V[i]);
            }
            ord.push_back({U[i], V[i], i});
        }
        if(si[U[i]] && si[V[i]]) {
            if(d2[U[i]] > d2[V[i]]) {
                swap(U[i], V[i]);
            }
            orz.push_back({U[i], V[i], i});
        }
    }
    sort(ord.begin(), ord.end(), [](array<int, 3> x, array<int, 3> y) {
        return d1[x[0]] < d1[y[0]];
    });
    sort(orz.begin(), orz.end(), [](array<int, 3> x, array<int, 3> y) {
        return d2[x[0]] < d2[y[0]];
    });

    int u = -1, v = -1;
    for(int l = 0, r = (int)ord.size(); l <= r;) {
        int mid = (l + r) >> 1;
        vector<int> w(m, 0);
        for(int i = mid; i < ord.size(); i++) {
            w[ord[i][2]] = 1;
        }
        for(int i = 0; i < pos; i++) {
            w[i] = 1;
        }
        if(ask(w) == len * a) {
            if(!mid) u = x;
            else u = ord[mid - 1][1];
            r = mid - 1;
        }
        else l = mid + 1;
    }
    for(int l = 0, r = (int)orz.size(); l <= r;) {
        int mid = (l + r) >> 1;
        vector<int> w(m, 0);
        for(int i = mid; i < orz.size(); i++) {
            w[orz[i][2]] = 1;
        }
        for(int i = 0; i < pos; i++) {
            w[i] = 1;
        }
        if(ask(w) == len * a) {
            if(!mid) v = y;
            else v = orz[mid - 1][1];
            r = mid - 1;
        }
        else l = mid + 1;
    }
    answer(u, v);
}

详细

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 1ms
memory: 3968kb

input:

100 99 1 2 0 75
15 17
47 98
19 41
22 51
38 7
96 5
47 75
28 12
6 0
25 76
0 11
32 66
97 81
23 56
32 94
46 79
18 2
0 3
44 33
89 97
49 31
43 65
56 9
71 93
87 18
12 37
94 34
73 42
66 15
15 8
27 85
3 37
57 28
74 12
69 60
91 24
82 39
60 15
67 78
1 47
19 92
86 75
30 38
86 14
50 96
38 89
50 68
70 52
63 12
12...

output:

Accepted: 15

result:

points 1.0

Test #2:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

100 99 1 3 0 36
11 81
47 21
71 13
78 32
34 10
82 98
70 67
61 44
86 5
87 41
6 85
64 5
2 62
75 81
84 72
27 13
90 81
53 9
8 24
96 92
5 94
89 58
46 85
63 36
14 88
16 38
35 50
66 16
61 65
1 0
14 71
25 47
45 77
62 5
61 17
94 91
73 34
18 89
91 84
42 31
55 6
28 65
20 13
45 57
82 52
25 71
53 65
24 96
29 70
3...

output:

Accepted: 16

result:

points 1.0

Test #3:

score: 5
Accepted
time: 1ms
memory: 3840kb

input:

99 98 2 3 0 93
70 6
50 24
45 49
11 55
98 84
48 33
39 31
61 84
9 94
57 11
77 5
44 92
88 89
1 13
16 31
15 25
64 25
78 70
51 70
11 0
22 11
48 96
82 62
22 1
63 68
74 49
85 36
11 77
90 72
35 30
91 66
30 57
23 49
22 65
70 42
59 26
7 2
6 22
15 60
43 31
75 40
12 30
37 96
70 71
26 87
76 8
68 81
34 98
72 77
7...

output:

Accepted: 15

result:

points 1.0

Test #4:

score: 5
Accepted
time: 1ms
memory: 3840kb

input:

99 98 2 5 0 80
43 14
52 42
67 92
53 11
55 90
38 55
51 22
44 94
80 65
94 72
63 84
85 29
82 25
3 92
46 17
1 7
72 40
37 38
20 13
12 23
57 60
49 8
58 42
14 20
65 60
96 71
73 72
17 6
41 82
44 34
15 49
69 86
20 87
67 20
79 6
77 14
21 38
92 36
70 69
67 84
76 41
19 72
10 75
30 82
41 85
35 34
94 83
82 68
72 ...

output:

Accepted: 15

result:

points 1.0

Test #5:

score: 5
Accepted
time: 0ms
memory: 3968kb

input:

89 88 1 999 0 57
76 64
52 61
11 84
84 6
4 28
88 18
25 55
23 82
41 81
83 10
73 31
50 17
15 68
42 39
64 41
57 22
46 49
36 67
3 35
50 21
66 61
77 16
76 50
78 87
20 19
30 71
38 19
31 79
0 70
8 30
30 21
30 13
27 87
39 32
16 45
61 51
16 57
25 5
17 65
86 79
2 53
82 36
76 26
84 4
67 39
85 50
59 41
12 47
38 ...

output:

Accepted: 10

result:

points 1.0

Test #6:

score: 5
Accepted
time: 1ms
memory: 3840kb

input:

100 99 994 999 0 51
79 56
61 86
88 77
54 3
39 81
26 21
23 34
69 39
27 55
36 61
44 92
81 13
12 82
60 4
35 57
99 41
86 41
20 2
28 43
61 7
69 28
78 98
46 17
12 39
32 3
89 55
48 71
37 50
89 72
81 61
44 91
40 73
39 3
11 39
11 31
94 3
78 70
66 5
12 75
93 86
42 47
3 2
87 61
30 12
11 40
48 3
2 1
34 62
59 57...

output:

Accepted: 17

result:

points 1.0

Test #7:

score: 5
Accepted
time: 0ms
memory: 3840kb

input:

84 83 34199442 81363925 0 11
60 80
4 52
1 45
26 36
33 44
65 83
32 22
14 50
11 68
76 17
18 25
72 47
17 0
4 79
66 81
48 11
50 53
25 12
11 22
40 71
48 58
78 42
23 19
24 13
49 23
77 56
30 50
50 37
61 81
11 50
78 82
59 17
39 31
80 73
61 56
12 48
63 60
67 23
37 83
72 11
31 43
53 15
63 2
74 71
14 7
48 4
63...

output:

Accepted: 14

result:

points 1.0

Test #8:

score: 5
Accepted
time: 1ms
memory: 3840kb

input:

97 96 34264977 81298389 0 24
79 81
13 14
9 23
83 68
16 44
52 79
86 35
14 39
45 29
83 69
28 15
62 24
63 47
64 32
46 2
78 52
16 3
16 80
44 48
9 41
42 82
45 55
71 39
86 65
14 29
59 44
65 37
66 92
34 69
34 48
70 51
66 86
54 45
90 72
45 30
38 72
76 91
46 65
5 92
44 61
68 6
46 94
79 26
33 96
10 51
42 18
8...

output:

Accepted: 14

result:

points 1.0

Test #9:

score: 5
Accepted
time: 0ms
memory: 3968kb

input:

100 99 1 3 0 80
39 11
0 92
29 15
92 29
31 67
99 34
91 6
88 92
22 95
29 42
92 32
43 31
93 87
87 66
24 77
83 56
65 28
71 92
6 45
74 51
2 42
95 81
43 50
30 70
67 63
54 15
46 40
69 18
93 62
5 12
91 20
56 93
68 92
60 99
94 53
75 92
20 4
92 13
48 35
3 14
91 55
68 43
75 86
51 76
20 98
87 92
21 10
53 36
3 4...

output:

Accepted: 16

result:

points 1.0

Test #10:

score: 5
Accepted
time: 1ms
memory: 3840kb

input:

96 95 1 3 0 49
10 23
57 42
77 88
56 47
71 27
84 85
67 77
23 51
57 59
68 85
50 55
91 6
59 41
24 77
81 43
9 66
46 20
4 40
68 26
77 6
88 3
53 4
16 81
74 87
67 32
69 82
46 6
81 36
12 22
27 69
63 51
24 15
69 47
88 11
1 64
24 75
70 6
93 48
13 93
58 6
4 27
29 68
78 32
82 50
46 94
76 24
91 28
3 21
0 25
71 1...

output:

Accepted: 18

result:

points 1.0

Test #11:

score: 5
Accepted
time: 1ms
memory: 3968kb

input:

100 99 1 3 0 34
79 80
74 76
8 5
76 0
36 15
99 63
18 87
45 3
55 47
57 30
90 49
60 39
67 3
27 18
13 83
26 78
7 78
33 44
92 53
17 58
61 12
15 46
72 11
6 40
14 41
5 89
60 47
54 25
38 95
91 58
80 77
35 2
49 50
27 29
90 92
26 2
30 52
69 48
24 31
1 37
34 71
32 48
57 97
70 41
1 32
82 8
57 50
84 91
41 23
29 ...

output:

Accepted: 17

result:

points 1.0

Test #12:

score: 5
Accepted
time: 0ms
memory: 3968kb

input:

96 95 1 3 0 65
22 68
84 89
36 52
37 66
62 32
63 35
95 23
28 23
65 35
35 3
47 68
72 38
38 55
54 83
33 64
66 88
83 10
73 59
3 17
78 76
66 56
91 94
68 26
30 43
2 14
33 31
25 66
18 29
90 7
12 39
67 14
45 76
28 20
60 79
19 78
77 12
64 85
21 17
51 27
67 20
34 19
32 0
34 79
62 61
58 87
21 15
93 94
81 41
37...

output:

Accepted: 17

result:

points 1.0

Subtask #2:

score: 7
Accepted

Test #13:

score: 7
Accepted
time: 2ms
memory: 4096kb

input:

1000 999 1 3 0 874
571 255
559 871
73 988
563 389
502 605
104 306
874 383
591 152
89 697
365 670
830 695
726 652
271 643
284 50
607 442
30 361
579 346
435 799
972 675
310 421
122 47
222 915
343 917
622 336
888 484
48 11
761 419
305 678
504 115
28 121
133 132
369 296
415 982
408 434
24 132
492 764
94...

output:

Accepted: 22

result:

points 1.0

Test #14:

score: 7
Accepted
time: 6ms
memory: 5472kb

input:

10000 9999 1 3 0 7650
1956 9583
750 9613
4903 611
675 6702
3628 3571
4850 7322
3611 2556
4971 1034
149 4505
728 9017
468 6098
108 5935
2193 6777
1768 8614
7347 961
1341 3402
3645 5743
4379 3376
8128 8157
9926 3111
5351 3204
7818 1909
1405 3238
6580 6390
4042 1739
6798 6558
695 8033
4018 6957
7477 33...

output:

Accepted: 32

result:

points 1.0

Test #15:

score: 7
Accepted
time: 146ms
memory: 19772kb

input:

89984 89983 2 3 0 8171
69624 27073
57492 50949
87302 23770
58569 25522
46384 852
74767 44114
3603 50509
7215 41305
83793 18052
16589 14237
77297 47271
82559 26151
3 81805
54730 53056
86372 62634
3299 88656
72074 37902
35991 32666
3221 60381
57345 42180
74758 42769
37513 50521
35162 92
88795 58758
58...

output:

Accepted: 39

result:

points 1.0

Test #16:

score: 7
Accepted
time: 195ms
memory: 20108kb

input:

90000 89999 3 5 0 9787
31426 9563
74235 81496
38520 6517
11701 51839
85042 28043
50073 61622
46926 34705
84653 28903
76796 23219
82188 36168
70477 54902
6933 31383
68638 15818
26575 67047
86757 66798
41823 26039
2089 87236
89902 38350
46929 49521
19763 47298
19285 78881
13472 3168
38311 78306
82080 ...

output:

Accepted: 45

result:

points 1.0

Test #17:

score: 7
Accepted
time: 155ms
memory: 20012kb

input:

89987 89986 1 999 0 34264
69117 5428
23307 32564
42662 83195
40342 33713
85662 26972
2874 19921
81991 72696
25970 85583
19606 31465
7945 16179
70412 85550
43062 38879
64490 61714
32717 40618
39878 10308
61584 78163
50061 13946
70732 17652
4666 15571
51812 28286
52136 52684
20777 34764
39800 75399
57...

output:

Accepted: 41

result:

points 1.0

Test #18:

score: 7
Accepted
time: 167ms
memory: 18992kb

input:

90000 89999 951 979 0 59327
31927 26220
17982 69928
37914 17648
25609 65641
18853 76109
45962 23772
10714 83594
32963 70370
65449 76112
25452 78067
14657 11555
82966 7166
61595 19412
62355 60667
69368 81839
53714 51996
2336 62745
15549 29270
29783 69680
31239 30573
25359 87650
5394 59795
48695 60530...

output:

Accepted: 33

result:

points 1.0

Test #19:

score: 7
Accepted
time: 75ms
memory: 19624kb

input:

89984 89983 17923947 65518761 0 42973
89870 63330
54842 69048
64708 86910
69151 69753
12452 37644
58100 29290
57575 88394
13696 22878
5157 31762
72362 78939
10765 88930
58817 31765
21030 29234
41018 58550
36210 28283
83631 69160
35316 87688
13697 47823
67327 35309
84073 42025
37223 32836
21922 21839...

output:

Accepted: 43

result:

points 1.0

Test #20:

score: 7
Accepted
time: 122ms
memory: 20360kb

input:

89999 89998 17858411 65584297 0 30156
82474 89408
37093 36620
27056 66761
7024 85975
9093 39622
15753 34221
11559 26643
40143 23752
86084 89281
45521 80876
35725 67219
8019 54485
66469 54728
45692 70339
12829 28049
5929 30101
30387 55564
64070 72832
9716 83340
59455 40888
87561 6925
61629 28190
8023...

output:

Accepted: 43

result:

points 1.0

Test #21:

score: 7
Accepted
time: 55ms
memory: 19372kb

input:

90000 89999 17792869 66174120 0 36619
49207 41536
32887 63388
59297 45941
19458 33983
5648 52466
65000 79415
44467 86826
26542 32811
49987 36657
53294 89301
14793 37140
77190 67749
21902 25889
46606 56049
66255 6066
85443 7120
1122 2203
13702 19909
58453 8776
70261 45199
36317 80311
84901 3539
9473 ...

output:

Accepted: 37

result:

points 1.0

Test #22:

score: 7
Accepted
time: 156ms
memory: 19652kb

input:

89997 89996 17727334 66239655 0 11195
52995 7804
39936 70456
54990 88305
65497 1591
6479 1426
33387 60478
35876 2999
55843 62742
48517 39317
75884 30693
73898 60777
7886 19626
62821 60475
85407 45144
85737 67068
26812 22312
28870 65366
8187 1395
38201 79854
21922 74140
10347 25868
37533 19454
87734 ...

output:

Accepted: 41

result:

points 1.0

Test #23:

score: 7
Accepted
time: 79ms
memory: 18136kb

input:

89984 89983 1 2 0 39557
19208 72217
88162 20574
89039 5847
50298 58532
32671 86473
9551 747
77703 52578
25654 16571
49032 62072
45335 40664
50821 84979
38620 86972
51462 41894
59693 19755
87421 51348
42602 81442
59597 18148
2360 66418
49749 43018
58297 68745
45960 67490
51486 65672
59707 54728
13937...

output:

Accepted: 39

result:

points 1.0

Test #24:

score: 7
Accepted
time: 132ms
memory: 19132kb

input:

89999 89998 1 3 0 68649
1167 78750
46842 7932
47129 81434
77037 22080
57183 13335
9638 15691
54159 61123
19869 66648
81702 41514
76809 71431
70896 55939
67862 65549
75770 34895
39118 79415
45574 89724
6039 30185
84917 1028
27027 62633
78798 75177
55355 56337
69616 18686
80403 25721
27304 68660
88159...

output:

Accepted: 48

result:

points 1.0

Test #25:

score: 7
Accepted
time: 102ms
memory: 18960kb

input:

90000 89999 2 3 0 89356
45134 87184
76185 46543
55632 8270
37036 80951
39426 74503
64476 79401
13066 17384
3330 3976
6701 80619
32527 77298
64933 59488
43327 63595
86867 59536
16734 55988
60034 46814
5729 59470
72912 57466
32789 66310
76037 76563
70058 36038
3365 25442
72461 71214
21428 25435
11068 ...

output:

Accepted: 46

result:

points 1.0

Test #26:

score: 7
Accepted
time: 167ms
memory: 19260kb

input:

89997 89996 17465186 65977507 0 66138
51213 70688
15848 4097
26079 76032
12450 77116
70559 6197
76698 1410
76087 19640
19749 1748
59085 41146
11327 11139
84930 60735
71562 40190
42112 10873
55942 20968
39693 19306
423 36453
74599 21467
58459 57959
85030 66413
30305 64381
31875 82598
22398 19613
5921...

output:

Accepted: 46

result:

points 1.0

Subtask #3:

score: 6
Accepted

Test #27:

score: 6
Accepted
time: 3ms
memory: 5368kb

input:

10000 9999 1 3 1402 1418
0 1
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
...

output:

Accepted: 28

result:

points 1.0

Test #28:

score: 6
Accepted
time: 7ms
memory: 6888kb

input:

20002 20001 3 5 3646 7187
0 1
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49...

output:

Accepted: 30

result:

points 1.0

Test #29:

score: 6
Accepted
time: 8ms
memory: 8100kb

input:

30000 29999 3 4 26368 26404
0 1
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 ...

output:

Accepted: 28

result:

points 1.0

Test #30:

score: 6
Accepted
time: 33ms
memory: 18492kb

input:

90000 89999 97 116 34441 51220
0 1
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
...

output:

Accepted: 35

result:

points 1.0

Test #31:

score: 6
Accepted
time: 21ms
memory: 18396kb

input:

90000 89999 995 999 33558 33576
0 1
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48...

output:

Accepted: 35

result:

points 1.0

Test #32:

score: 6
Accepted
time: 46ms
memory: 18876kb

input:

90000 89999 1 5 18002 75519
0 1
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 ...

output:

Accepted: 35

result:

points 1.0

Test #33:

score: 6
Accepted
time: 21ms
memory: 17360kb

input:

90000 89999 1 3 85340 85378
0 1
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 ...

output:

Accepted: 31

result:

points 1.0

Test #34:

score: 6
Accepted
time: 35ms
memory: 18744kb

input:

90000 89999 3 7 26589 59072
0 1
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 ...

output:

Accepted: 35

result:

points 1.0

Test #35:

score: 6
Accepted
time: 25ms
memory: 18008kb

input:

90000 89999 50162688 65928896 66873 68839
0 1
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
4...

output:

Accepted: 32

result:

points 1.0

Subtask #4:

score: 33
Accepted

Test #36:

score: 33
Accepted
time: 1ms
memory: 4224kb

input:

1000 999 1 2 685 383
303 325
476 191
222 120
555 130
655 639
211 393
795 613
389 888
960 815
446 325
846 315
51 348
409 82
470 402
681 258
772 969
767 164
290 46
34 887
453 584
142 73
814 603
36 665
701 727
200 702
638 685
33 580
422 859
550 486
849 250
319 144
189 502
140 63
650 765
251 942
304 99
...

output:

Accepted: 22

result:

points 1.0

Test #37:

score: 33
Accepted
time: 7ms
memory: 5500kb

input:

10000 9999 1 3 1783 6259
7293 57
7709 5040
9728 4012
8079 8209
9430 4904
6390 9228
7715 5997
9936 717
5226 52
9173 3051
7832 7311
6952 8564
6226 7816
433 4639
3438 5850
6341 4537
1863 4404
6454 5466
2929 5366
8417 4118
2366 3037
2780 757
5705 4213
5398 7910
6730 4996
5791 8331
9429 5235
9846 1200
39...

output:

Accepted: 38

result:

points 1.0

Test #38:

score: 33
Accepted
time: 45ms
memory: 16688kb

input:

70000 69999 2 3 69377 57081
8691 23855
42416 26863
36340 62234
30435 61792
63863 4516
4636 25229
3248 68179
9283 69793
42520 59468
58572 41154
16070 59343
50253 19571
39285 60461
11716 59229
70 21580
59258 28359
46256 31086
1697 10419
6315 30818
43294 44315
12932 67250
47382 45633
60342 37095
20798 ...

output:

Accepted: 37

result:

points 1.0

Test #39:

score: 33
Accepted
time: 77ms
memory: 19996kb

input:

90000 89999 2 5 35232 76942
53804 2560
15424 27043
10952 12954
14737 68830
84217 83878
68168 83680
84589 77984
11599 88281
33002 45594
77176 17505
46533 24317
18737 79850
43298 13933
3154 59768
84384 36480
76561 970
10035 3859
80097 57252
49426 53816
57169 28470
79807 38894
87458 40681
47806 12433
7...

output:

Accepted: 38

result:

points 1.0

Test #40:

score: 33
Accepted
time: 40ms
memory: 18464kb

input:

90000 89999 1 999 75529 42434
757 76472
72284 42735
84542 60958
87348 69975
48235 29959
41762 40404
18137 42129
11928 51602
82056 31169
76652 59301
77992 33674
81364 72825
23678 54579
40691 58120
60317 58742
63439 37100
55772 33925
56044 56850
78860 54354
40063 14610
22086 2314
6740 18580
24820 3095...

output:

Accepted: 31

result:

points 1.0

Test #41:

score: 33
Accepted
time: 39ms
memory: 18412kb

input:

90000 89999 998 999 19174 88306
88819 80793
24709 16886
87714 69518
9860 18262
69745 59806
87377 71749
34643 76631
38597 47679
53979 58087
73942 76322
367 38974
89171 27560
24684 87172
2298 72538
78495 65918
82333 42756
18548 10115
75478 24068
4244 6126
62473 29047
30188 42440
74334 63982
48723 2220...

output:

Accepted: 27

result:

points 1.0

Test #42:

score: 33
Accepted
time: 45ms
memory: 19260kb

input:

90000 89999 84756501 96592857 8069 15634
88972 32923
86285 44296
34869 12825
69263 9698
71730 86194
74326 13418
80037 11174
89814 52530
85129 34939
49406 89856
69091 10098
13888 57075
53331 90
88354 66705
13722 67849
79880 23223
40733 10142
3993 51160
3983 46488
29214 36413
84361 75729
40004 87059
6...

output:

Accepted: 36

result:

points 1.0

Test #43:

score: 33
Accepted
time: 45ms
memory: 18488kb

input:

89876 89875 84690965 96658393 65440 79610
62557 24631
50667 52218
71222 20279
55343 29295
28042 25096
48354 48136
16633 60977
12634 65312
25764 22391
80561 63107
67435 20089
9306 54466
87784 87952
36416 6315
68014 58390
2747 25618
89608 12827
84269 196
14913 32291
86214 32900
84021 53768
58249 69167...

output:

Accepted: 32

result:

points 1.0

Test #44:

score: 33
Accepted
time: 211ms
memory: 19796kb

input:

90000 89999 84625435 97248216 82814 31088
51015 10875
49862 12824
7738 33938
30451 54289
42321 20170
49989 21460
32539 35045
82692 39222
31928 18139
28539 39878
8619 33316
56032 64573
42212 75158
33852 5251
26607 14817
2640 6436
40106 54067
62168 38651
9886 46439
73906 40418
57881 81640
49695 11975
...

output:

Accepted: 46

result:

points 1.0

Test #45:

score: 33
Accepted
time: 126ms
memory: 19896kb

input:

90000 89999 84559899 97313751 46009 356
49280 20843
71631 68122
17142 58679
47093 7625
25786 54249
86536 31544
74040 85894
30164 20977
75901 76109
62058 85690
50789 11417
22516 13971
80488 66340
71068 80236
87518 13703
61664 64111
79079 85756
82353 85285
55711 59383
30628 44155
60842 65626
20073 509...

output:

Accepted: 45

result:

points 1.0

Test #46:

score: 33
Accepted
time: 149ms
memory: 19120kb

input:

89999 89998 84494361 97379286 68409 40471
58091 55986
41432 11038
49026 20769
63696 49689
73753 28221
49729 24835
13374 42761
15177 2624
64983 2349
62963 32808
48165 63378
24578 7350
43368 30476
10232 34399
28206 8193
71230 86962
72276 32065
17336 37383
80620 16553
63438 36739
70606 48937
57159 3693...

output:

Accepted: 44

result:

points 1.0

Test #47:

score: 33
Accepted
time: 213ms
memory: 18888kb

input:

90000 89999 84428826 97444821 86993 85959
28205 22189
75392 83052
16836 49224
20499 21835
19391 63054
17404 17787
52539 17518
51899 10499
80799 70818
35882 59182
41944 54106
19505 83764
62920 82524
41747 84871
70270 44505
47685 74211
83722 83160
73354 11145
71772 19921
21509 88332
31466 35442
17205 ...

output:

Accepted: 47

result:

points 1.0

Test #48:

score: 33
Accepted
time: 165ms
memory: 18876kb

input:

90000 89999 84363295 96986068 41990 40818
13455 87897
26812 53959
20220 21624
43143 52503
87371 16861
48123 50380
41422 36733
34848 14993
41472 4697
19948 73965
4426 29738
12757 78110
2033 23791
900 33101
61512 74289
72275 86019
24850 65323
15917 52861
2128 7625
58016 73171
76305 8093
4674 47724
351...

output:

Accepted: 46

result:

points 1.0

Test #49:

score: 33
Accepted
time: 132ms
memory: 18136kb

input:

90000 89999 84297760 97051603 25948 49593
16049 88216
88927 2893
6701 16230
26242 5993
62393 29535
66436 15317
79996 33106
57662 33997
20342 43780
45094 29872
34927 8855
60807 62088
40782 78406
11440 17603
88262 8499
14064 13734
66408 65413
14045 8608
16054 87709
81212 68877
28332 44853
83848 28343
...

output:

Accepted: 45

result:

points 1.0

Test #50:

score: 33
Accepted
time: 43ms
memory: 18464kb

input:

90000 89999 1 2 79502 30695
8722 72520
33536 21737
23927 32489
79131 55071
46257 81030
1898 10469
33578 44097
19901 60670
48032 47644
73748 71566
20567 42125
85013 71846
43154 75392
78130 7502
62011 50400
73744 80710
11833 84720
72752 14930
80113 68496
58429 1584
74801 28097
64733 45826
72580 28154
...

output:

Accepted: 31

result:

points 1.0

Test #51:

score: 33
Accepted
time: 42ms
memory: 18336kb

input:

90000 89999 1 3 17482 13313
79984 80956
66296 83354
61612 57672
80302 51046
57021 38334
25208 32978
60251 43574
67427 53267
64018 72499
61419 86283
84036 5948
25665 71043
26372 18416
17789 78520
2541 79081
84174 11687
49402 30606
54040 47791
76876 88865
59405 28911
7682 13900
69932 16932
88549 433
2...

output:

Accepted: 22

result:

points 1.0

Test #52:

score: 33
Accepted
time: 200ms
memory: 18984kb

input:

90000 89999 2 3 31448 60972
39735 38348
77576 60616
45300 79310
56233 70217
32122 46410
59695 54854
40776 13452
16311 27378
57582 41243
20212 27596
59620 81319
5217 59792
31179 48046
17400 4604
10124 75234
45658 16254
69881 60141
7028 70432
66513 84218
33216 60207
38661 57399
81954 50689
22072 45135...

output:

Accepted: 46

result:

points 1.0

Test #53:

score: 33
Accepted
time: 121ms
memory: 19260kb

input:

90000 89999 3 5 46917 27608
51668 66320
72390 8436
66569 42525
7258 70607
47106 11795
81791 11305
48127 83126
46344 88655
767 54179
34124 64031
66451 42381
59883 3338
75316 62384
69516 7187
86505 42642
44122 44231
49156 55779
13710 2795
54967 40684
39671 9391
43114 27035
78489 81839
38900 227
60406 ...

output:

Accepted: 45

result:

points 1.0

Test #54:

score: 33
Accepted
time: 37ms
memory: 18380kb

input:

90000 89999 1 5 11917 59698
48059 55574
74545 23244
18960 65141
57990 6692
42489 34595
20694 22182
48651 55698
42871 34906
21820 88871
20350 71101
45556 45684
9340 15711
25628 80556
44731 55372
36268 48118
74379 76844
12215 50968
78832 23754
30856 73960
68987 78470
85696 68574
50838 14151
41673 4078...

output:

Accepted: 26

result:

points 1.0

Test #55:

score: 33
Accepted
time: 43ms
memory: 18124kb

input:

90000 89999 3 7 2746 22489
86854 50688
83895 23396
73808 73919
37344 62897
9035 71782
51104 48328
30761 37562
47256 46092
26771 85378
38195 75174
80727 53120
88415 60808
53181 49240
79751 75275
55102 8947
58509 76037
26439 22545
70750 22901
16196 21018
88289 16638
33085 52114
40851 84270
40376 55571...

output:

Accepted: 38

result:

points 1.0

Test #56:

score: 33
Accepted
time: 47ms
memory: 19764kb

input:

89999 89998 1 3 42826 75299
14680 25145
44410 25145
25145 64904
25145 78135
81486 25145
25145 77409
35565 25145
25145 1126
25145 61075
25145 71493
75959 25145
25145 17396
72069 25145
25145 82793
494 25145
66448 25145
25145 89711
87741 25145
25145 62903
25145 17520
59798 25145
19472 25145
76524 25145...

output:

Accepted: 34

result:

points 1.0

Test #57:

score: 33
Accepted
time: 52ms
memory: 19752kb

input:

90000 89999 3 5 77100 47672
55349 57815
71476 55349
55349 20332
55349 4237
55349 25765
55349 55565
55349 33540
55349 42110
51449 55349
55349 14619
55349 72484
55349 55510
88278 55349
55349 37838
55349 88099
65019 55349
55349 71755
33961 55349
55349 84231
13879 55349
55349 23543
55349 24579
21541 553...

output:

Accepted: 33

result:

points 1.0

Test #58:

score: 33
Accepted
time: 85ms
memory: 20844kb

input:

90000 89999 2 3 74823 9530
24143 51229
67591 62223
23318 24143
24471 24143
35836 24143
67591 85539
67591 24440
67790 24143
67591 4034
67591 17739
46783 67591
17649 24143
65765 67591
11170 24143
67591 80923
2872 67591
25076 24143
4405 67591
58416 35248
24143 55420
73706 24143
56381 24143
80738 24143
...

output:

Accepted: 48

result:

points 1.0

Test #59:

score: 33
Accepted
time: 117ms
memory: 20668kb

input:

90000 89999 1 3 58087 71198
75078 65143
7713 59219
35200 59219
59219 37628
59219 1440
59219 6045
46669 59219
82395 59219
75078 67489
75078 20211
9719 59219
3684 48759
59219 69421
72588 75078
59219 30484
46963 13624
3623 3741
53121 59219
23065 75078
68137 59219
59219 15835
41997 75078
75078 66585
592...

output:

Accepted: 47

result:

points 1.0

Test #60:

score: 33
Accepted
time: 471ms
memory: 19360kb

input:

90000 89999 1 2 40427 11356
86311 16411
86389 66778
520 44957
64508 29690
72626 70901
37673 11702
29970 54794
23952 44215
54500 4189
80271 19101
37940 39587
2447 45028
25661 64690
63290 54066
24892 48174
66022 2139
37195 79132
32839 78347
48862 41029
43133 65670
78745 44560
8290 10780
77052 21346
15...

output:

Accepted: 46

result:

points 1.0

Subtask #5:

score: 18
Accepted

Test #61:

score: 18
Accepted
time: 15ms
memory: 5504kb

input:

10000 11000 1 2 4410 9396
4021 14
6386 7290
4635 4576
1295 5062
8655 8174
3709 4958
7062 1337
6608 2435
9704 3638
5777 2945
1125 365
2861 1023
1560 8478
1423 7827
2638 6211
1429 4399
626 6111
9981 7033
7740 7631
3904 3628
2812 6221
9946 2671
1646 6255
2653 7666
5575 3080
8314 2317
1868 7058
8177 514...

output:

Accepted: 38

result:

points 1.0

Test #62:

score: 18
Accepted
time: 11ms
memory: 5556kb

input:

10000 12000 1 2 8914 2754
434 1136
9173 573
3454 6615
2946 288
3915 3593
3828 6746
6635 665
7131 1042
4342 6970
1127 3292
8034 8501
3356 2570
1952 3736
4431 4448
8634 7879
7196 3553
611 9163
7930 5623
4745 5326
4688 2034
8854 9034
6558 9927
7478 9489
987 1460
141 7334
8768 8671
6973 4170
5359 7289
5...

output:

Accepted: 36

result:

points 1.0

Test #63:

score: 18
Accepted
time: 242ms
memory: 20912kb

input:

90000 100000 1 2 75322 63546
69499 27559
38229 1171
57605 41391
37236 5292
31433 88838
3541 3671
82244 70112
30156 75569
18991 16709
22697 35556
40077 61048
38380 81312
6303 77697
10570 27814
23603 14312
9273 54292
5697 44097
70695 35843
86903 38883
80677 25435
41667 74744
5605 14057
49672 74026
297...

output:

Accepted: 45

result:

points 1.0

Test #64:

score: 18
Accepted
time: 194ms
memory: 20968kb

input:

90000 110000 1 2 74466 67848
68097 22477
20007 34939
28196 24201
80526 63080
20627 81623
12008 46314
16911 53629
49816 193
71014 25845
13945 51574
65448 24107
44331 54812
55021 37430
60283 75844
28330 81393
21311 35513
65936 64670
33857 13492
45048 67079
39197 83746
24176 70511
67941 47342
23434 618...

output:

Accepted: 47

result:

points 1.0

Test #65:

score: 18
Accepted
time: 178ms
memory: 22956kb

input:

90000 130000 1 2 56305 39836
1604 82119
43477 2753
47523 67309
71136 15561
20783 44710
39073 31749
6828 14770
47157 11662
80463 70032
17608 25155
73309 2097
60275 65633
74034 14638
87431 58865
68932 58173
21478 53704
52412 44267
52702 56477
56226 71197
2970 7354
39550 88510
26905 54644
55560 86979
7...

output:

Accepted: 47

result:

points 1.0

Test #66:

score: 18
Accepted
time: 298ms
memory: 22756kb

input:

90000 130000 1 2 63390 29918
43935 67677
64814 71435
7795 86165
9178 14941
49328 26067
87813 3426
41778 47453
3316 27333
68266 87896
89807 74352
30386 69164
19434 74827
12972 47452
88521 54592
20891 32716
86567 2892
61130 13173
75178 34646
9395 58963
13646 4810
73395 42900
70573 42572
66106 1489
823...

output:

Accepted: 48

result:

points 1.0

Test #67:

score: 18
Accepted
time: 194ms
memory: 22688kb

input:

90000 130000 1 2 11022 89395
75693 84971
30696 47119
58426 19067
34383 87899
35529 14786
11402 88537
14569 85256
89788 26671
45642 5813
32553 68443
23961 68708
1437 58824
49694 46233
62923 59227
19534 68125
73800 44065
65575 58256
38526 12890
16338 84303
16848 7588
49529 365
79859 56
76961 25871
356...

output:

Accepted: 49

result:

points 1.0

Test #68:

score: 18
Accepted
time: 207ms
memory: 22476kb

input:

90000 130000 1 2 42568 68186
44784 80303
10319 1023
14043 15412
83359 89919
71326 14771
8602 21355
35485 15804
80662 34042
18358 26369
13635 59420
65758 17748
2070 79076
20146 16442
6084 46290
65228 51742
68485 26027
75950 12124
82601 74582
61984 66774
70563 73800
9064 63841
72933 29722
40428 38750
...

output:

Accepted: 36

result:

points 1.0

Test #69:

score: 18
Accepted
time: 56ms
memory: 13932kb

input:

32500 129984 1 2 17145 30635
14009 29302
14009 16717
9015 17145
15541 30635
24409 14009
30635 14954
9663 14009
15681 30635
30635 15407
3212 11707
31629 17145
28667 30635
30635 22814
27336 14009
3212 27236
6231 30635
17145 22972
3212 16275
7475 14009
3212 10046
6190 30635
17145 4119
29928 14009
3212 ...

output:

Accepted: 30

result:

points 1.0

Test #70:

score: 18
Accepted
time: 66ms
memory: 16312kb

input:

26005 130000 1 2 17389 23170
22758 10732
22543 23408
19301 17389
25848 18936
18936 21025
22543 25892
22758 2303
770 18936
10696 4373
22850 4373
16352 4373
7382 17389
14837 4373
21654 4373
22513 22758
7977 22543
4373 17414
14556 18936
17389 21040
22543 21380
9862 22543
20597 4373
17389 10282
9182 437...

output:

Accepted: 35

result:

points 1.0

Test #71:

score: 18
Accepted
time: 78ms
memory: 16984kb

input:

43336 129999 1 2 40683 35521
41428 32662
40272 8988
11590 40272
7529 1202
25635 32662
41612 32662
7826 1202
21439 1202
18202 1202
39915 32662
33928 32662
40272 43192
40272 23213
1202 18345
9969 40272
1202 35363
20797 32662
9771 40272
32662 28112
37902 1202
1202 2684
24763 1202
1202 14882
8498 32662
...

output:

Accepted: 47

result:

points 1.0

Test #72:

score: 18
Accepted
time: 226ms
memory: 20676kb

input:

70000 130000 1 2 12082 33698
2041 69065
5594 28202
10139 48201
42264 10807
66517 68153
65426 27453
58395 24217
34142 37910
22813 58534
61004 46048
56533 12536
28282 34558
3712 36145
8523 26736
43967 37211
44260 52228
51598 61827
49018 6934
58546 11515
7889 1367
51698 40877
30983 67523
56527 62118
56...

output:

Accepted: 47

result:

points 1.0

Test #73:

score: 18
Accepted
time: 308ms
memory: 21836kb

input:

80000 130000 1 2 70535 1479
13359 18444
73669 22258
58337 12045
8313 40132
21941 79229
41570 63403
37064 25743
44232 63761
6550 16704
42608 14275
65195 7235
34857 19223
65254 53255
46439 59331
38681 55367
18754 70301
8364 11042
38816 12200
10790 14654
43230 26323
52177 59980
75027 73274
76631 31985
...

output:

Accepted: 48

result:

points 1.0

Test #74:

score: 18
Accepted
time: 325ms
memory: 22432kb

input:

90000 130000 1 2 81353 14372
1814 50386
49949 8841
18485 48540
31404 17735
49460 16918
63609 73761
17963 55286
88012 45069
65092 18570
18706 81565
66791 56550
82790 51553
78254 29064
85966 64252
58779 28647
6896 89081
27375 28761
67930 87464
83173 72025
60593 73258
21239 9556
41259 68364
51611 46047...

output:

Accepted: 49

result:

points 1.0

Test #75:

score: 18
Accepted
time: 188ms
memory: 22944kb

input:

90000 130000 1 2 43430 75970
20894 78655
17259 52737
86412 28029
10066 77941
32717 82814
19927 82084
31793 6727
41526 12024
76712 87917
27384 20411
88138 30872
1041 22052
40962 50417
1956 74883
74948 46403
85110 24636
86947 82692
36199 66364
66985 36858
21851 75036
13689 18029
76564 33981
63210 7655...

output:

Accepted: 49

result:

points 1.0

Test #76:

score: 18
Accepted
time: 241ms
memory: 16996kb

input:

40000 130000 1 2 3543 31868
9327 23935
488 9296
39320 36958
11233 14888
10193 24928
23307 3931
14071 466
14565 27118
27107 232
12 8283
17315 25143
20137 5459
24896 37715
37294 36912
21165 28737
29891 20181
24550 30296
30681 32703
32397 34887
37270 5672
9642 24009
5321 5482
32554 16001
28742 39725
12...

output:

Accepted: 46

result:

points 1.0

Test #77:

score: 18
Accepted
time: 83ms
memory: 19852kb

input:

90000 90077 1 2 19507 86979
63114 43668
80323 42112
8043 43668
73130 43668
29142 58534
12229 80323
47654 4741
69729 80323
53136 37314
21489 36171
10603 61287
4741 81706
45775 80323
82529 4659
44037 23724
65247 4741
68284 80127
12079 44037
4659 19469
68284 8898
4741 8724
4741 3076
44709 21489
76098 6...

output:

Accepted: 47

result:

points 1.0

Test #78:

score: 18
Accepted
time: 61ms
memory: 19724kb

input:

90000 90645 1 2 59941 54343
59224 54591
33911 3524
57007 54687
89361 54591
38141 72388
6711 47898
67158 82659
64438 79303
83297 36703
12620 59478
15407 67158
77667 4981
57007 50764
15854 26792
6280 40423
36619 6280
53304 22863
84773 43020
44972 53304
69908 45900
2632 57007
84773 64210
54591 26517
63...

output:

Accepted: 44

result:

points 1.0

Test #79:

score: 18
Accepted
time: 120ms
memory: 20816kb

input:

90000 91237 1 2 47140 66381
70557 81006
4259 79799
70557 11531
12653 37318
69368 54356
28886 49923
54356 79696
16928 64415
39882 59163
19882 57513
72150 28296
77487 63735
53581 26626
85218 57513
17101 37318
13642 51701
77898 53581
29271 64415
26284 43955
13361 70557
64620 25920
49923 49489
62375 543...

output:

Accepted: 46

result:

points 1.0

Test #80:

score: 18
Accepted
time: 86ms
memory: 19912kb

input:

90000 91552 1 2 67400 65764
6293 20923
10800 55604
37577 4367
70934 24489
80637 33172
80637 84932
57728 66871
80637 62900
17086 13335
40790 24000
59461 77114
72897 63680
20923 77812
21882 7101
61322 64345
20923 70220
42394 24000
4367 42852
57482 32837
18876 41448
55584 46077
18876 17130
33683 47012
...

output:

Accepted: 44

result:

points 1.0

Test #81:

score: 18
Accepted
time: 117ms
memory: 22908kb

input:

90000 130000 1 2 56041 3751
57822 2190
37634 86425
74793 72752
51911 79624
83271 81467
52456 82938
36898 5716
74567 34246
84944 57418
35207 31391
85323 60624
35750 16156
58747 6055
17708 40790
64822 29532
41180 88280
41300 13004
53523 54357
70242 45781
86632 78604
87962 66133
86916 28833
66882 22323...

output:

Accepted: 49

result:

points 1.0

Subtask #6:

score: 31
Accepted

Test #82:

score: 31
Accepted
time: 10ms
memory: 5600kb

input:

10000 11000 1 3 242 6594
7153 1171
3833 5240
2223 8238
7347 5616
7332 7717
1485 7260
2323 3839
7359 9719
6973 7446
9821 1553
4652 663
3200 30
9465 9801
5461 4480
2298 513
5950 7473
4726 6408
7990 2674
4736 7663
9124 7932
1022 807
6870 6840
8507 62
4036 7781
1867 4826
9093 6486
9303 7974
5399 4503
90...

output:

Accepted: 38

result:

points 1.0

Test #83:

score: 31
Accepted
time: 17ms
memory: 5692kb

input:

10000 12000 2 3 4857 2452
4361 665
4690 1770
2293 1547
4473 1035
7838 4758
3370 7154
5965 4793
6751 7912
108 311
7994 7516
930 1881
3688 8582
8788 3182
9538 8770
3705 6854
1082 7659
3142 3131
1749 6271
6129 8039
7431 848
4893 206
8341 6642
1088 100
8427 6334
1946 6672
1221 501
1019 7308
7802 538
658...

output:

Accepted: 36

result:

points 1.0

Test #84:

score: 31
Accepted
time: 83ms
memory: 20932kb

input:

90000 101000 4 5 56091 53745
50551 69009
41341 69902
10324 82455
21704 16360
38034 86326
20751 84303
12519 5756
26410 49921
61625 87388
41276 27250
64383 64446
60811 69266
63192 35949
67415 4762
49420 53900
52643 74779
55133 85578
25210 63881
65649 42267
33905 13198
1353 72860
26338 81080
21165 7860...

output:

Accepted: 48

result:

points 1.0

Test #85:

score: 31
Accepted
time: 169ms
memory: 21212kb

input:

90000 105000 3 99 86503 23751
17425 85839
2827 42783
68907 30080
9311 44087
34334 16980
62285 50804
34671 25544
58671 73724
78917 86481
69381 36611
33743 44518
80626 1026
71227 75339
77255 36925
72285 38384
23232 15852
30552 36813
78564 53390
5032 9979
45179 43133
19536 17869
78481 76272
8052 50389
...

output:

Accepted: 47

result:

points 1.0

Test #86:

score: 31
Accepted
time: 212ms
memory: 21312kb

input:

90000 110000 3 999 73530 26097
15598 49512
19727 2591
44549 68835
83814 37610
26854 23699
34946 22039
31851 70554
81204 72799
43004 16235
9657 58241
84910 45683
57949 20644
64023 60528
16622 63229
3705 86052
2665 70592
46261 70450
18172 65840
55300 80502
86781 30316
89894 23688
60142 285
77211 24461...

output:

Accepted: 48

result:

points 1.0

Test #87:

score: 31
Accepted
time: 195ms
memory: 22764kb

input:

90000 130000 4 111 86771 33394
68780 6781
47630 19590
38335 80190
30551 84588
13107 11858
17336 72950
68287 35327
1788 40577
34803 64419
29337 88444
33354 75479
25641 82542
37999 17902
7122 73725
74971 52218
43234 68889
88640 68809
63697 83358
87572 59823
56081 59311
65971 18204
71515 38052
28070 59...

output:

Accepted: 48

result:

points 1.0

Test #88:

score: 31
Accepted
time: 152ms
memory: 20548kb

input:

90000 101000 7573002 75878368 46648 38155
71367 6224
27929 77151
8358 45628
23234 66538
9800 22816
54769 57218
26883 71773
8326 79184
45648 77456
41168 12433
52653 766
73164 59043
24450 28514
18887 82103
83964 61359
84125 65179
8871 60833
56587 32516
14549 21648
34242 86851
70299 30944
51963 10588
8...

output:

Accepted: 36

result:

points 1.0

Test #89:

score: 31
Accepted
time: 145ms
memory: 21200kb

input:

90000 105000 7638537 75812831 69741 417
28159 43542
29693 15583
76468 49324
73012 68820
66940 88793
78282 77505
12682 86146
699 60478
78259 31759
88497 4361
80557 57918
84210 57937
80923 47259
24784 71460
34354 87012
57446 80594
406 88435
64356 72649
47179 9710
31766 20718
60865 18462
48374 39523
49...

output:

Accepted: 46

result:

points 1.0

Test #90:

score: 31
Accepted
time: 170ms
memory: 21180kb

input:

90000 110000 8228359 75747281 34819 443
86473 7773
72621 68673
70253 62005
49348 87750
16060 73587
53940 15781
8607 70604
9351 14296
14689 56999
59957 36697
41691 50724
54680 79573
87458 72928
75264 20740
7713 75602
43747 83489
46790 21112
78865 14850
10684 74960
4821 77161
48931 1022
62035 36859
54...

output:

Accepted: 48

result:

points 1.0

Test #91:

score: 31
Accepted
time: 171ms
memory: 22320kb

input:

90000 130000 1 3 68121 25307
1310 38917
12821 57526
23843 18404
52199 58819
72709 64995
83666 88294
50659 669
13377 32321
47684 84131
29837 23817
24240 48591
66096 74754
87243 18069
31385 25678
26538 23623
55934 62968
47063 9277
37300 21771
82547 86170
74316 87028
12188 28107
50431 28491
83994 83363...

output:

Accepted: 48

result:

points 1.0

Test #92:

score: 31
Accepted
time: 412ms
memory: 22736kb

input:

90000 130000 2 3 26702 10877
86423 32406
58706 6043
18472 46458
5067 28107
74464 24967
46685 83212
22758 1408
87091 60526
88737 72748
4833 24620
5485 58192
74512 81880
54084 23575
64359 76538
44832 53200
73473 69584
42242 81010
6795 80816
6146 79271
15547 71246
11584 69589
64973 76363
48869 29098
10...

output:

Accepted: 49

result:

points 1.0

Test #93:

score: 31
Accepted
time: 149ms
memory: 22712kb

input:

90000 130000 2 5 34986 9743
79304 29323
66236 68082
6019 34213
4073 47380
10584 24008
30024 15420
83928 27708
72502 63144
66586 8626
3381 81153
1 18210
4776 55807
16573 69850
54091 40931
64819 60781
48981 82204
15250 36794
26337 53852
12134 68037
15119 36712
65633 89543
84750 5543
43018 79242
15379 ...

output:

Accepted: 48

result:

points 1.0

Test #94:

score: 31
Accepted
time: 68ms
memory: 16184kb

input:

43336 129999 7966211 75485141 28523 28549
959 28523
28523 20436
28523 33883
28523 29267
12973 28549
28523 8195
37558 3122
14722 28523
32260 28549
7767 3122
19128 3122
18131 3122
19969 28523
3122 41170
3751 28549
19805 28523
9063 3122
18848 3122
28523 11694
3122 7893
33627 28523
28523 41765
28549 778...

output:

Accepted: 33

result:

points 1.0

Test #95:

score: 31
Accepted
time: 61ms
memory: 14824kb

input:

26005 130000 8031747 75419606 485 6122
20218 3858
12025 20218
19964 8426
22482 6547
2338 6122
9898 485
2202 6122
24612 20218
6547 2997
23884 6122
20218 1838
19284 485
20218 3358
13658 19964
3476 20218
6122 12994
6547 20576
25185 20218
6122 9647
21527 19964
21983 485
6547 1232
6547 13420
16974 6122
2...

output:

Accepted: 34

result:

points 1.0

Test #96:

score: 31
Accepted
time: 78ms
memory: 17112kb

input:

43336 129999 8097282 75354071 31917 19304
7352 31917
34977 31917
26497 21356
21356 37130
30855 31917
27605 23008
31917 19256
31917 5103
27605 32012
31917 38917
23888 21356
21356 3796
38279 31917
27605 28234
32421 21356
27605 19142
19908 27605
21356 36779
23777 31917
1790 31917
953 31917
29162 27605
...

output:

Accepted: 46

result:

points 1.0

Test #97:

score: 31
Accepted
time: 69ms
memory: 16616kb

input:

26005 130000 8162817 75288535 7056 7365
19911 22209
12379 16925
12379 3736
22112 15156
7998 12379
22209 5881
12379 1065
42 22209
22209 22829
12379 14869
18664 22112
10126 12379
94 12379
4138 12379
7333 6963
7199 12379
6678 22209
22112 12419
24216 22209
22112 1479
10582 6963
6963 20199
12379 2457
123...

output:

Accepted: 35

result:

points 1.0

Test #98:

score: 31
Accepted
time: 87ms
memory: 16940kb

input:

43336 129999 89902903 91975679 40144 38801
34819 43150
30470 39135
13346 39135
18855 39135
34819 24701
42382 22660
42382 13244
4469 34819
39135 14136
11773 34819
37321 34819
39135 9071
39135 12477
27686 42382
36195 42382
28004 34819
39135 34030
42382 39331
42679 42382
34819 21601
39135 10239
34819 3...

output:

Accepted: 47

result:

points 1.0

Test #99:

score: 31
Accepted
time: 76ms
memory: 15852kb

input:

26005 130000 89837367 92041215 2053 17517
19207 23312
8234 973
15809 19207
9379 18475
8234 18686
2431 1763
8234 14201
1763 2759
552 18475
10114 1763
18475 9618
5705 8234
2187 19207
3477 18826
18475 6440
1791 1763
18826 4404
1763 22572
8361 8234
4083 18826
1763 12269
19207 20719
11795 1763
10802 1882...

output:

Accepted: 48

result:

points 1.0

Test #100:

score: 31
Accepted
time: 353ms
memory: 21176kb

input:

70000 130000 89771830 92106750 64899 43376
67528 28322
26576 22982
38186 14740
57594 56187
25979 30232
65553 45368
20289 17602
13179 64952
45108 5173
55493 40360
29803 10606
21745 22641
4927 66240
69801 36240
10015 53904
37580 64538
22121 33558
43512 46809
55594 33010
28308 67671
44796 57928
44609 2...

output:

Accepted: 48

result:

points 1.0

Test #101:

score: 31
Accepted
time: 127ms
memory: 21740kb

input:

80000 130000 89706293 92172285 33684 32502
27336 60498
45702 51900
70109 3126
29652 75420
50161 50325
40654 43357
72698 74678
27236 28118
33950 18363
44106 34463
32809 15797
56216 55241
51348 30561
73188 7725
48512 62007
51177 43604
45260 23222
7017 23095
24805 65629
11235 13277
25351 11860
23386 16...

output:

Accepted: 49

result:

points 1.0

Test #102:

score: 31
Accepted
time: 225ms
memory: 22968kb

input:

90000 130000 1 5 78581 72518
16014 47090
35437 18841
38473 42515
76502 53643
36413 81426
40571 18853
27897 57934
15833 34320
37 62017
77762 75051
46199 11544
60161 34043
11538 13394
77508 85928
38113 83036
76712 75724
1164 14307
69722 17297
84092 10340
13092 47791
66629 46334
51877 15719
40766 65284...

output:

Accepted: 49

result:

points 1.0

Test #103:

score: 31
Accepted
time: 245ms
memory: 22384kb

input:

89431 130000 1 3 72567 78913
9412 47015
80397 70127
31759 56375
66129 89132
73321 67320
70230 31589
70205 13966
68083 4746
7032 76827
53872 36177
61088 14763
81413 42185
42595 14032
65958 27552
14708 20097
48340 41301
14886 3542
88413 51093
44920 65086
37820 21085
24760 35532
64550 28919
68076 69204...

output:

Accepted: 49

result:

points 1.0

Test #104:

score: 31
Accepted
time: 291ms
memory: 22424kb

input:

90000 130000 1 4 45590 22397
76661 54098
77568 65817
16701 51042
9196 81305
27230 78832
11992 45228
14188 18211
86439 59316
15942 39868
22309 18093
33106 28673
89129 26108
25710 71943
87110 68376
36132 58785
23914 78326
83369 66542
83783 56872
31920 74001
66848 42836
55728 4743
17921 55987
65041 328...

output:

Accepted: 48

result:

points 1.0

Test #105:

score: 31
Accepted
time: 264ms
memory: 22892kb

input:

90000 130000 3 4 64122 48243
41321 50117
29837 12207
13689 26938
32404 30649
68775 54982
77290 21957
63766 62100
37493 59357
47541 80455
80391 71257
21119 24370
86124 32735
24884 28588
5566 58749
24368 55518
2845 28050
75359 75966
61514 48114
32888 78253
88665 69756
36332 52651
53362 56455
49802 267...

output:

Accepted: 49

result:

points 1.0

Test #106:

score: 31
Accepted
time: 163ms
memory: 22564kb

input:

90000 130000 1 3 68259 72605
46887 1781
65722 78792
12384 21169
47802 21650
14826 4864
10429 32121
87423 27794
76411 80966
80323 47336
49352 70504
59843 87066
4719 85201
26170 28888
39442 68043
11049 59084
67738 5732
72891 79203
8869 41130
86509 19599
6343 76699
29176 41042
87589 4345
45511 84034
79...

output:

Accepted: 49

result:

points 1.0

Test #107:

score: 31
Accepted
time: 188ms
memory: 23436kb

input:

90000 130000 1 2 11107 69182
31628 80076
11256 78831
42192 38646
85230 13423
8390 51939
41069 57016
75760 76748
34304 49
38154 4596
19310 40799
27396 16243
25818 55094
88698 21566
4215 48325
43182 4690
81901 54079
86992 51249
41540 18728
67885 79493
40954 71363
15330 2863
46383 16117
83875 21425
149...

output:

Accepted: 49

result:

points 1.0

Test #108:

score: 31
Accepted
time: 79ms
memory: 20140kb

input:

90000 90613 1 3 72690 32698
32461 13373
86465 61289
74739 87732
17180 46232
85280 26521
39549 28723
58738 66607
22241 39549
70478 58409
79984 61289
23110 58480
58409 22935
82549 23110
53320 61365
13652 85079
80222 21393
35823 3702
22920 3702
82346 59113
17542 61365
59113 52342
58738 67755
5421 13652...

output:

Accepted: 45

result:

points 1.0

Test #109:

score: 31
Accepted
time: 83ms
memory: 20668kb

input:

90000 91219 1 3 63036 8344
76195 66771
51849 59861
5334 60761
80806 71545
3147 34317
69463 5334
38712 67187
64870 30513
51849 79403
76133 34317
51849 57109
5334 77073
49014 28405
82756 76195
13207 4069
51849 39863
3738 80207
84150 48799
55774 8947
25686 82468
38712 29661
66574 26549
18686 13390
1602...

output:

Accepted: 44

result:

points 1.0

Test #110:

score: 31
Accepted
time: 94ms
memory: 21272kb

input:

90000 92180 3 5 38888 77757
80669 27604
50346 53745
37407 83140
6383 77913
7704 5271
60580 56393
8118 53745
47420 11396
64103 71844
7047 86426
21593 5271
55988 19277
44006 38742
31527 24055
47362 11396
3445 28554
37407 17264
52853 59725
37407 9644
1051 11396
80693 639
45194 44763
74435 56310
77913 7...

output:

Accepted: 35

result:

points 1.0

Test #111:

score: 31
Accepted
time: 107ms
memory: 20740kb

input:

90000 92726 89050939 92303347 25458 43127
23648 34777
50490 56474
47827 84575
85449 19509
26152 89006
85449 45286
27443 9007
78448 48911
85449 57180
9007 54347
72442 51460
35606 66169
30930 22130
88340 78448
4549 27134
88497 78448
55648 17331
78448 16351
61516 85449
8783 10054
18784 48145
79540 1878...

output:

Accepted: 36

result:

points 1.0

Test #112:

score: 31
Accepted
time: 97ms
memory: 20700kb

input:

90000 90829 1 4 36551 6864
74585 74224
12397 64648
29186 70559
12056 55497
69765 74585
55497 47600
29186 63050
64578 28761
85370 41975
52464 41975
17284 28778
67987 31134
40703 31396
28448 82520
77812 77850
9068 87788
15034 31396
9781 31145
56242 28000
45065 50757
38579 20682
60495 31145
82520 64737...

output:

Accepted: 45

result:

points 1.0

Test #113:

score: 31
Accepted
time: 89ms
memory: 20652kb

input:

90000 90970 2 3 51817 53037
78798 3540
24235 70965
49356 5586
78798 80313
49710 61946
11514 61946
677 42771
25375 73888
29927 70965
61200 78430
26633 28448
31252 85427
56511 70965
73893 9107
1154 42771
1473 35057
76755 26633
27153 372
49799 61200
5368 27527
8588 50479
6029 81349
39599 31252
40968 25...

output:

Accepted: 47

result:

points 1.0

Test #114:

score: 31
Accepted
time: 131ms
memory: 21460kb

input:

90000 92008 3 5 7813 16565
59529 57248
4225 67106
26152 56540
73307 10431
87590 44455
54778 48465
73307 23484
2579 33047
66774 36932
22563 50278
46113 84273
72826 20639
54899 24025
65869 45105
65980 48776
1760 50665
35405 85815
5470 80762
59529 62481
1363 28303
24651 27376
31670 54066
25177 85815
72...

output:

Accepted: 46

result:

points 1.0

Test #115:

score: 31
Accepted
time: 102ms
memory: 20464kb

input:

90000 91241 1 5 4712 59809
44314 88565
64515 33511
4055 15567
34820 82691
43694 27715
37875 78323
15567 33013
60180 19122
42103 55617
27715 49084
34820 89809
27715 16039
20025 80914
81529 44892
87651 15567
82768 150
12991 67648
34820 76742
33511 77028
20025 12921
9466 26590
67648 76953
86767 88681
7...

output:

Accepted: 47

result:

points 1.0

Test #116:

score: 31
Accepted
time: 93ms
memory: 20216kb

input:

90000 90799 1 3 10824 37068
36952 26418
36623 13675
56432 87498
39084 26418
67938 7804
42830 63972
74199 69207
82715 80733
57701 62388
38798 30179
30179 12716
87516 42830
47622 32831
7051 47622
31759 56692
66088 30179
37043 56432
60265 57079
60868 57079
15061 31759
59829 31759
56432 53475
30179 4885...

output:

Accepted: 45

result:

points 1.0

Test #117:

score: 31
Accepted
time: 89ms
memory: 20704kb

input:

90000 91114 3 5 55128 53962
84842 51506
84842 29800
72673 64469
64469 11384
30144 62927
45271 61489
32814 48153
4546 75454
15431 30144
58746 87979
62660 43162
39733 30144
25360 55619
34259 2573
45140 2039
51635 84842
78873 79130
54833 73668
39786 19422
30144 87986
34441 30144
41650 78873
58746 41789...

output:

Accepted: 47

result:

points 1.0

Test #118:

score: 31
Accepted
time: 88ms
memory: 20980kb

input:

90000 92129 5 7 75292 47564
43418 48697
14293 62255
32915 34343
6918 28227
32832 32915
64037 6918
73699 12474
25603 20404
9873 31315
9873 36793
25690 5912
10011 71908
26296 16841
45767 83888
10563 79258
88705 63622
9873 40489
16008 48260
20404 6335
17755 22762
62143 32670
32910 13936
58503 80909
308...

output:

Accepted: 45

result:

points 1.0

Test #119:

score: 31
Accepted
time: 115ms
memory: 20800kb

input:

90000 95219 90623777 92827627 82691 68846
31472 21032
21057 87792
84347 71328
87712 26637
21754 52829
12902 58340
26299 45886
44828 74504
49065 21910
18850 57822
5386 48808
5386 48842
62867 5386
1670 33703
87712 62839
47558 31472
79907 66434
5121 21968
13437 76445
75924 33703
5386 68293
47518 17055
...

output:

Accepted: 34

result:

points 1.0

Test #120:

score: 31
Accepted
time: 161ms
memory: 22968kb

input:

90000 130000 1 3 59996 83673
83132 89505
55263 1853
79143 60359
42817 63577
56134 4946
18262 1369
3361 75159
47265 68389
88346 1064
88716 64072
49004 21505
79348 14566
22274 8942
38263 89211
40032 71037
40562 29150
42872 66362
59933 81137
7218 59383
89918 14936
57067 24069
59434 58442
11277 12449
26...

output:

Accepted: 49

result:

points 1.0

Test #121:

score: 31
Accepted
time: 168ms
memory: 23096kb

input:

90000 130000 1 3 3639 80219
85253 78668
10890 63942
41734 89529
78246 65721
10828 34292
8083 10525
81093 50338
3234 32414
20815 54316
79537 57649
86390 27360
37536 586
70215 86962
80092 33264
61467 78886
54650 2133
43322 75532
55888 18239
60357 24914
21875 69602
25543 63691
70191 80052
35698 12676
4...

output:

Accepted: 50

result:

points 1.0

Test #122:

score: 31
Accepted
time: 358ms
memory: 23204kb

input:

90000 130000 3 5 77389 14672
12743 56444
25162 35013
36034 66232
59559 27337
40377 68051
26806 66690
230 72306
67090 57824
39238 29028
24975 51717
6729 30486
6925 75262
55396 5488
5992 14106
16840 26581
32947 4846
13197 86208
36498 86723
71692 34974
17689 74385
79433 19140
5971 13933
45903 54927
826...

output:

Accepted: 40

result:

points 1.0

Test #123:

score: 31
Accepted
time: 146ms
memory: 23836kb

input:

89999 129979 246274153 738822459 86592 89146
45229 35419
54295 16475
70021 990
23618 86585
7588 14444
77630 1598
77229 76364
22305 75700
72487 53976
62196 20540
28531 11111
50348 4057
81556 36457
16864 22877
45048 41419
45194 28845
35286 12491
30492 49512
69769 60495
8427 52018
12177 85260
54558 627...

output:

Accepted: 50

result:

points 1.0

Extra Test:

score: 0
Extra Test Passed