QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#875629#2746. Highway TollsWansur51 288ms21732kbC++202.8kb2025-01-30 00:12:462025-01-30 00:12:54

Judging History

This is the latest submission verdict.

  • [2025-01-30 00:12:54]
  • Judged
  • Verdict: 51
  • Time: 288ms
  • Memory: 21732kb
  • [2025-01-30 00:12:46]
  • Submitted

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];
ll d1[maxn], d2[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;
    res.push_back({v, v, -1});
    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;
    }

    vector<int> ww(m, 0);
    ww[0] = 1;
    bfs(U[pos], d1);
    bfs(V[pos], d2);

    vector<int> s, t;
    for(int i = 0; i < n; i++) {
        if(d1[i] < d2[i]) {
            s.push_back(i);
        }
        if(d2[i] < d1[i]) {
            t.push_back(i);
        }
        if(d1[i] < d2[i]) d2[i] = -1;
        else if(d2[i] < d1[i]) d1[i] = -1;
    }

    auto ord = bfs(U[pos], d1);
    auto orz = bfs(V[pos], d2);

    int u = -1, v = -1;
    vector<int> W(m, 1);
    for(auto [u, v, id] : ord) {
        W[id] = 0;
    }
    ll tot = ask(W);

    for(int l = 0, r = (int)ord.size() - 1; l <= r;) {
        int mid = (l + r) >> 1;
        vector<int> w(m, 1);
        for(int i = 1; i < ord.size(); i++) {
            w[ord[i][2]] = (i > mid);
        }
        if(ask(w) == tot) {
            u = ord[mid][1];
            r = mid - 1;
        }
        else l = mid + 1;
    }

    W = vector<int> (m, 1);
    for(auto [u, v, id] : orz) {
        W[id] = 0;
    }
    tot = ask(W);

    for(int l = 0, r = (int)orz.size() - 1; l <= r;) {
        int mid = (l + r) >> 1;
        vector<int> w(m, 1);
        for(int i = 1; i < orz.size(); i++) {
            w[orz[i][2]] = (i > mid);
        }
        if(ask(w) == tot) {
            v = orz[mid][1];
            r = mid - 1;
        }
        else l = mid + 1;
    }

    answer(u, v);
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

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

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: 17

result:

points 1.0

Test #2:

score: 5
Accepted
time: 1ms
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: 18

result:

points 1.0

Test #3:

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

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: 17

result:

points 1.0

Test #4:

score: 5
Accepted
time: 0ms
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: 17

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: 12

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: 19

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: 16

result:

points 1.0

Test #8:

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

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: 16

result:

points 1.0

Test #9:

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

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: 17

result:

points 1.0

Test #10:

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

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: 20

result:

points 1.0

Test #11:

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

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: 19

result:

points 1.0

Test #12:

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

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: 19

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: 24

result:

points 1.0

Test #14:

score: 7
Accepted
time: 5ms
memory: 5588kb

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: 35

result:

points 1.0

Test #15:

score: 7
Accepted
time: 124ms
memory: 20292kb

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: 41

result:

points 1.0

Test #16:

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

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: 46

result:

points 1.0

Test #17:

score: 7
Accepted
time: 140ms
memory: 20656kb

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: 44

result:

points 1.0

Test #18:

score: 7
Accepted
time: 147ms
memory: 20396kb

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: 36

result:

points 1.0

Test #19:

score: 7
Accepted
time: 83ms
memory: 20244kb

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: 45

result:

points 1.0

Test #20:

score: 7
Accepted
time: 115ms
memory: 21020kb

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: 47

result:

points 1.0

Test #21:

score: 7
Accepted
time: 41ms
memory: 20100kb

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: 39

result:

points 1.0

Test #22:

score: 7
Accepted
time: 139ms
memory: 20508kb

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: 43

result:

points 1.0

Test #23:

score: 7
Accepted
time: 57ms
memory: 18644kb

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: 41

result:

points 1.0

Test #24:

score: 7
Accepted
time: 113ms
memory: 19900kb

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: 51

result:

points 1.0

Test #25:

score: 7
Accepted
time: 85ms
memory: 19896kb

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: 48

result:

points 1.0

Test #26:

score: 7
Accepted
time: 150ms
memory: 19896kb

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: 48

result:

points 1.0

Subtask #3:

score: 6
Accepted

Test #27:

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

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: 30

result:

points 1.0

Test #28:

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

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: 32

result:

points 1.0

Test #29:

score: 6
Accepted
time: 6ms
memory: 8432kb

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: 30

result:

points 1.0

Test #30:

score: 6
Accepted
time: 34ms
memory: 19252kb

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: 37

result:

points 1.0

Test #31:

score: 6
Accepted
time: 20ms
memory: 19248kb

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: 37

result:

points 1.0

Test #32:

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

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: 37

result:

points 1.0

Test #33:

score: 6
Accepted
time: 23ms
memory: 18132kb

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: 33

result:

points 1.0

Test #34:

score: 6
Accepted
time: 43ms
memory: 19384kb

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: 37

result:

points 1.0

Test #35:

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

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: 34

result:

points 1.0

Subtask #4:

score: 33
Accepted

Test #36:

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

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: 25

result:

points 1.0

Test #37:

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

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: 39

result:

points 1.0

Test #38:

score: 33
Accepted
time: 32ms
memory: 17252kb

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: 39

result:

points 1.0

Test #39:

score: 33
Accepted
time: 67ms
memory: 20760kb

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: 40

result:

points 1.0

Test #40:

score: 33
Accepted
time: 28ms
memory: 18964kb

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: 33

result:

points 1.0

Test #41:

score: 33
Accepted
time: 28ms
memory: 18964kb

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: 29

result:

points 1.0

Test #42:

score: 33
Accepted
time: 38ms
memory: 20088kb

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: 38

result:

points 1.0

Test #43:

score: 33
Accepted
time: 31ms
memory: 19200kb

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: 33

result:

points 1.0

Test #44:

score: 33
Accepted
time: 201ms
memory: 21156kb

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: 49

result:

points 1.0

Test #45:

score: 33
Accepted
time: 118ms
memory: 20328kb

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: 47

result:

points 1.0

Test #46:

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

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: 47

result:

points 1.0

Test #47:

score: 33
Accepted
time: 187ms
memory: 19732kb

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: 49

result:

points 1.0

Test #48:

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

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: 48

result:

points 1.0

Test #49:

score: 33
Accepted
time: 112ms
memory: 18568kb

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: 47

result:

points 1.0

Test #50:

score: 33
Accepted
time: 31ms
memory: 19100kb

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: 34

result:

points 1.0

Test #51:

score: 33
Accepted
time: 32ms
memory: 18728kb

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: 24

result:

points 1.0

Test #52:

score: 33
Accepted
time: 150ms
memory: 19636kb

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: 48

result:

points 1.0

Test #53:

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

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: 47

result:

points 1.0

Test #54:

score: 33
Accepted
time: 31ms
memory: 18972kb

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: 28

result:

points 1.0

Test #55:

score: 33
Accepted
time: 33ms
memory: 18248kb

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: 40

result:

points 1.0

Test #56:

score: 33
Accepted
time: 55ms
memory: 20784kb

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: 36

result:

points 1.0

Test #57:

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

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: 36

result:

points 1.0

Test #58:

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

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: 50

result:

points 1.0

Test #59:

score: 33
Accepted
time: 109ms
memory: 21500kb

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: 49

result:

points 1.0

Test #60:

score: 33
Accepted
time: 288ms
memory: 20732kb

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: 48

result:

points 1.0

Subtask #5:

score: 0
Wrong Answer

Test #61:

score: 0
Wrong Answer
time: 15ms
memory: 5728kb

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:

Wrong Answer: {s, t} is wrong

result:

wrong answer 

Subtask #6:

score: 0
Wrong Answer

Test #82:

score: 0
Wrong Answer
time: 9ms
memory: 5424kb

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:

Wrong Answer: {s, t} is wrong

result:

wrong answer