QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#536248#365. Railway Tripmakrav#20 145ms10936kbC++201.5kb2024-08-28 21:11:562024-08-28 21:11:58

Judging History

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

  • [2024-08-28 21:11:58]
  • 评测
  • 测评结果:20
  • 用时:145ms
  • 内存:10936kb
  • [2024-08-28 21:11:56]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define sz(x) (int)(x).size()
#define pb push_back

void solve() {
    int n, k, q; cin >> n >> k >> q;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];

    vector<vector<int>> g(n);
    stack<int> st;
    for (int i = n - 1; i >= 0; i--) {
        while (!st.empty() && a[st.top()] < a[i]) st.pop();
        if (!st.empty()) {
            g[i].pb(st.top());
            g[st.top()].pb(i);
        }
        st.push(i);
    }
    while (!st.empty()) st.pop();
    for (int i = 0; i < n; i++) {
        while (!st.empty() && a[st.top()] < a[i]) st.pop();
        if (!st.empty()) {
            g[i].pb(st.top());
            g[st.top()].pb(i);
        }
        st.push(i);
    }

    while (q--) {
        int l, r; cin >> l >> r;
        l--; r--;
        vector<int> dist(n, -1);
        dist[l] = 0;
        queue<int> q;
        q.push(l);
        while (!q.empty()) {
            int v = q.front();
            q.pop();
            for (auto &u : g[v]) {
                if (dist[u] == -1) {
                    dist[u] = dist[v] + 1;
                    q.push(u);
                }
            }
        }
        cout << dist[r] - 1 << '\n';
    }
}

signed main() {
    int tt = 1;
    #ifdef LOCAL 
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
        cin >> tt;
    #else 
        ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    #endif

    while (tt--) {
        solve();
    }
    return 0;
}

详细

Subtask #1:

score: 5
Accepted

Test #1:

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

input:

100 100 50
100
86
39
28
49
22
79
14
83
100
15
26
37
51
53
18
74
15
96
72
47
80
10
46
62
88
20
36
46
29
40
28
37
88
91
41
24
63
14
92
24
31
99
61
62
96
94
51
51
21
72
97
59
96
97
94
66
88
32
96
58
26
53
1
100
31
85
30
42
69
40
62
54
94
49
62
13
20
82
74
20
44
54
69
65
34
78
64
48
69
19
35
8
92
100
87...

output:

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

result:

ok 50 lines

Test #2:

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

input:

100 100 50
100
85
82
7
50
49
51
45
30
3
29
99
71
93
5
68
70
52
12
44
1
35
99
80
76
34
23
28
62
91
80
77
59
57
30
15
23
13
16
21
58
23
38
49
44
73
7
47
24
53
97
83
14
71
16
75
61
24
17
96
51
41
74
53
25
2
42
36
73
57
53
45
10
12
11
79
68
2
78
44
47
67
21
99
25
68
60
71
23
92
9
2
97
37
43
64
32
28
7
1...

output:

2
0
5
4
2
4
2
4
3
5
4
3
3
6
4
4
3
3
3
4
2
3
3
3
4
5
5
2
3
3
5
4
3
4
2
2
3
5
3
6
2
5
4
2
2
4
4
3
4
7

result:

ok 50 lines

Test #3:

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

input:

100 100 50
100
56
83
81
2
73
24
77
19
11
79
100
36
32
62
4
41
50
51
62
68
6
11
36
28
21
61
82
72
86
35
93
94
87
50
14
77
83
14
49
95
32
5
20
59
55
77
31
52
70
23
81
4
10
34
100
4
67
60
1
23
26
65
1
30
96
43
49
70
81
18
82
97
80
62
28
93
38
91
39
67
6
17
78
60
60
55
97
45
58
44
80
24
91
14
5
35
93
25...

output:

4
4
4
5
3
3
3
4
2
4
2
5
4
3
4
3
5
4
5
3
3
2
4
1
3
4
3
3
5
2
5
5
5
0
3
3
3
2
4
1
5
2
4
3
0
5
4
5
4
3

result:

ok 50 lines

Test #4:

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

input:

100 100 50
100
50
72
67
84
3
28
84
40
70
52
28
37
16
66
92
47
27
30
49
33
7
69
22
33
85
1
98
4
97
89
27
99
21
33
76
89
26
74
10
80
23
70
10
63
1
78
38
28
30
95
11
17
99
10
52
5
30
38
95
4
71
50
2
40
28
17
21
10
13
23
98
92
84
8
3
37
38
71
78
57
87
22
79
59
26
13
50
33
87
9
6
78
85
19
68
79
9
62
100
...

output:

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

result:

ok 50 lines

Test #5:

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

input:

100 100 50
100
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
100
91 65
31 33
13 98
45 91
54 50
94 66
78 5
28 13
100 4
15 63
55 2
72 49
97 18
57 59
40 ...

output:

25
1
14
45
3
27
26
14
3
47
46
22
20
1
6
1
22
27
15
39
25
36
35
24
14
12
35
32
48
5
9
2
26
4
27
17
36
35
10
15
38
7
16
2
48
3
31
32
48
6

result:

ok 50 lines

Test #6:

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

input:

100 100 50
100
99
99
99
97
97
97
95
95
95
93
93
93
91
91
91
89
89
89
87
87
87
85
85
85
83
83
83
81
81
81
79
79
79
77
77
77
75
75
75
73
73
73
71
71
71
69
69
69
67
67
67
68
68
70
70
70
72
72
72
74
74
74
76
76
76
78
78
78
80
80
80
82
82
82
84
84
84
86
86
86
88
88
88
90
90
90
92
92
92
94
94
94
96
96
96
...

output:

9
6
23
6
1
21
5
18
5
15
2
3
16
3
15
26
2
3
12
1
1
0
20
27
26
3
3
3
30
22
30
1
1
0
26
11
13
13
16
21
2
12
7
22
7
13
2
9
8
15

result:

ok 50 lines

Test #7:

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

input:

100 100 50
100
99
99
99
97
97
97
95
95
95
93
93
93
91
91
91
89
89
89
87
87
87
85
85
85
83
83
83
81
81
81
79
79
79
77
77
77
75
75
75
73
73
73
71
71
71
69
69
69
67
67
67
68
68
70
70
70
72
72
72
74
74
74
76
76
76
78
78
78
80
80
80
82
82
82
84
84
84
86
86
86
88
88
88
90
90
90
92
92
92
94
94
94
96
96
96
...

output:

9
20
22
8
30
3
22
11
2
8
10
5
1
26
10
20
19
21
1
6
17
2
6
9
13
9
20
25
24
1
25
19
4
14
15
23
10
19
19
3
2
3
9
24
9
10
17
10
7
14

result:

ok 50 lines

Test #8:

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

input:

100 30 50
30
29
29
29
27
27
27
25
25
25
23
23
23
21
21
21
19
19
19
17
17
17
15
15
15
13
13
13
11
11
11
9
9
9
7
7
7
5
5
5
3
3
3
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
4
4
4
6
6
6
8
8
8
10
10
10
12
12
12
14
14
14
16
16
16
18
18
18
20
20
20
22
22
22
24
24
24
26
26
26
28
28
28
30
29 60
12 67
26 10
71 29
70 5...

output:

9
15
10
3
14
21
20
17
4
8
18
0
2
6
16
3
11
12
7
14
2
8
17
3
13
7
3
3
7
21
6
6
10
2
9
11
5
0
18
9
20
14
2
2
7
26
3
3
9
13

result:

ok 50 lines

Test #9:

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

input:

10 10 50
10
7
7
4
1
9
3
8
1
10
8 9
2 7
7 6
4 2
7 4
5 8
6 7
10 2
1 9
7 2
9 1
2 7
5 8
6 9
1 3
5 2
9 5
5 3
5 8
4 8
7 5
10 7
3 7
6 1
9 1
2 8
3 1
9 7
4 1
6 9
10 7
3 9
5 4
3 1
8 2
2 3
5 10
4 6
10 5
6 4
5 8
10 7
2 6
5 8
1 6
6 4
2 6
6 8
10 8
7 9

output:

0
2
0
1
1
1
0
1
1
2
1
2
1
1
1
2
2
1
1
1
1
1
1
0
1
2
1
1
1
1
1
2
0
1
2
0
1
0
1
0
1
1
1
1
0
0
1
0
0
1

result:

ok 50 lines

Subtask #2:

score: 15
Accepted

Dependency #1:

100%
Accepted

Test #10:

score: 15
Accepted
time: 1ms
memory: 3656kb

input:

1000 1000 50
1000
922
228
50
969
778
800
874
487
278
681
989
234
951
889
87
926
534
311
876
955
989
810
841
423
580
204
360
127
808
441
249
754
777
831
192
797
272
163
832
471
669
837
129
774
425
435
315
515
626
725
883
415
932
9
891
34
146
288
321
980
972
776
449
458
188
75
412
81
523
705
137
564
7...

output:

10
5
8
4
6
3
5
3
5
5
3
5
7
6
6
6
10
5
2
5
9
4
10
6
7
7
10
4
5
5
2
7
7
7
6
6
5
7
5
6
10
6
9
2
3
9
6
6
5
7

result:

ok 50 lines

Test #11:

score: 15
Accepted
time: 127ms
memory: 10764kb

input:

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

output:

1359
1428
6356
1112
1488
1359
2215
713
4226
3135
1169
3371
2015
4999
274
3670
6146
666
1474
7777
4789
3933
3816
6070
4619
3537
9444
303
305
4196
5588
2949
2371
2426
4223
6478
5818
2204
4708
3962
4045
5028
576
7645
21
6384
1164
2279
1975
2912

result:

ok 50 lines

Test #12:

score: 15
Accepted
time: 129ms
memory: 10732kb

input:

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

output:

1266
721
574
2414
1804
2566
3123
2680
421
2509
2114
741
4862
144
321
2708
673
797
1103
8
474
754
798
3825
2887
3700
92
1263
836
162
889
410
1494
386
607
47
930
2160
2285
1414
1946
2546
217
2180
1348
1509
1934
1281
1155
269

result:

ok 50 lines

Test #13:

score: 15
Accepted
time: 134ms
memory: 10936kb

input:

100000 50 50
50
11
46
27
40
21
34
12
28
6
1
31
6
48
35
29
37
28
16
47
47
25
37
7
38
35
33
12
14
16
28
40
48
38
36
41
26
23
13
5
45
22
29
40
28
38
6
2
27
10
46
20
19
47
42
38
23
26
50
22
17
19
28
15
21
41
26
44
37
41
34
28
6
45
50
1
4
29
1
20
12
3
47
5
30
27
31
27
14
14
19
11
26
36
22
40
39
3
35
48
1...

output:

418
263
271
1079
65
35
1084
1365
1821
816
913
0
1716
948
1815
268
657
727
388
140
1122
1417
434
304
591
1462
534
26
6
1319
1013
653
51
403
1123
337
1298
681
291
922
1429
136
1267
404
172
639
1098
126
365
589

result:

ok 50 lines

Test #14:

score: 15
Accepted
time: 128ms
memory: 10916kb

input:

100000 100 50
100
56
93
96
24
53
1
36
62
6
78
9
80
45
58
9
73
66
88
84
70
23
72
45
51
30
39
34
58
29
58
86
42
60
22
85
31
5
97
84
43
29
9
39
59
99
22
19
64
37
73
38
3
56
100
7
70
7
63
85
3
37
89
3
37
86
15
38
77
8
69
93
84
88
6
42
2
97
83
52
50
30
87
100
6
35
6
57
29
85
43
5
44
53
70
70
37
28
1
79
5...

output:

75
421
426
64
188
480
375
230
205
110
514
521
202
438
41
90
550
600
278
41
555
306
227
374
314
251
329
106
349
326
237
168
85
733
493
732
287
292
420
48
82
185
268
586
138
18
58
563
132
880

result:

ok 50 lines

Test #15:

score: 15
Accepted
time: 132ms
memory: 10756kb

input:

100000 1000 50
1000
344
191
778
485
819
164
138
378
874
442
986
928
4
40
283
48
414
694
741
809
739
868
462
128
210
421
486
411
962
568
354
717
373
451
749
487
579
555
274
770
315
57
683
726
11
736
143
664
294
315
983
546
685
879
613
938
593
129
670
460
68
262
667
670
970
750
621
245
664
849
897
921...

output:

26
39
13
25
20
12
45
49
23
14
14
17
35
45
27
61
33
64
17
26
46
19
16
53
56
28
66
44
13
27
69
82
49
39
16
67
18
28
20
23
27
21
31
48
33
44
19
57
57
84

result:

ok 50 lines

Test #16:

score: 15
Accepted
time: 138ms
memory: 10808kb

input:

100000 100000 50
100000
56580
49884
11827
17239
65717
9804
79174
23154
24944
14239
25479
99414
34931
73537
80958
49760
64994
26812
21303
26338
69277
40768
58666
18101
14466
43220
86838
28869
93571
6030
83932
63479
7787
90481
41114
83812
43297
333
42187
89338
74969
29378
9198
54116
92280
44472
67702
...

output:

11
18
14
11
8
12
13
10
14
12
14
10
9
17
6
7
15
7
10
11
7
17
13
18
11
12
14
10
14
12
11
10
17
17
15
11
12
15
13
12
13
14
13
20
13
12
8
19
21
15

result:

ok 50 lines

Test #17:

score: 15
Accepted
time: 33ms
memory: 9844kb

input:

100000 98765 50
98765
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

8543
47309
23958
26174
49100
4352
16877
15157
4073
4915
27708
29524
37655
35894
27397
39765
13061
47027
34482
47152
22163
8303
34266
7734
48073
28964
44848
9697
33881
34902
49642
16645
37421
12636
45492
18481
10058
26951
24249
4493
16977
32341
34921
27407
6885
29650
38665
26423
20992
4006

result:

ok 50 lines

Test #18:

score: 15
Accepted
time: 40ms
memory: 10216kb

input:

100000 100000 50
100000
99999
99999
99999
99997
99997
99997
99995
99995
99995
99993
99993
99993
99991
99991
99991
99989
99989
99989
99987
99987
99987
99985
99985
99985
99983
99983
99983
99981
99981
99981
99979
99979
99979
99977
99977
99977
99975
99975
99975
99973
99973
99973
99971
99971
99971
99969
...

output:

8011
17947
19968
6041
2560
5984
12778
5061
6067
875
33330
1137
28701
506
9660
9077
4698
29794
3944
15977
624
15732
29615
569
12988
10918
6867
22754
9635
15808
8037
12778
28287
5842
16734
11588
22433
8009
25516
266
2178
10474
8818
19731
5938
5977
17163
13752
14967
22906

result:

ok 50 lines

Test #19:

score: 15
Accepted
time: 41ms
memory: 10032kb

input:

99987 20000 50
20000
19999
19999
19999
19997
19997
19997
19995
19995
19995
19993
19993
19993
19991
19991
19991
19989
19989
19989
19987
19987
19987
19985
19985
19985
19983
19983
19983
19981
19981
19981
19979
19979
19979
19977
19977
19977
19975
19975
19975
19973
19973
19973
19971
19971
19971
19969
199...

output:

4252
10848
8908
12418
11319
14639
23531
32898
33082
19996
4328
29974
15741
7631
15055
27561
33768
10747
8569
12964
26763
11238
1568
12149
16704
9780
853
117
12290
7524
16324
7480
9529
2496
6232
16327
18091
16754
16387
2168
29018
3881
4970
13707
3938
25233
4644
1343
5144
8130

result:

ok 50 lines

Test #20:

score: 15
Accepted
time: 118ms
memory: 10760kb

input:

100000 100000 50
100000
99999
99999
99999
99999
74745
62562
99999
98122
99999
99999
56828
99997
58955
99997
54699
67218
99997
50790
99997
58134
99995
99995
99995
99995
99995
99995
99995
55529
99993
99993
99993
99993
99993
99993
99991
99991
99991
99989
90797
99989
99989
99989
99989
99989
86368
99989
...

output:

6420
3248
359
6904
464
499
2049
2980
7120
6633
7065
7436
1723
1694
8588
11366
2553
4371
4307
1923
2788
47
3379
7678
10918
2206
10990
5473
9297
6117
13683
2404
3665
9394
4125
6942
10577
894
3737
476
9154
64
4418
7686
9593
14621
10711
673
6886
270

result:

ok 50 lines

Test #21:

score: 15
Accepted
time: 119ms
memory: 10780kb

input:

100000 40000 50
40000
39999
39999
37766
39999
39999
39999
39999
39999
39999
39999
39997
36045
25615
39997
39997
39997
39997
39997
39042
29937
39995
39995
39993
39993
39993
39993
39993
39991
39991
39991
39991
39991
39991
39991
39989
39989
39989
39989
39989
39989
39989
30300
39989
24555
39987
39987
39...

output:

286
6753
6738
2684
450
4653
5387
7493
10039
2298
1824
6432
1323
523
2223
9704
4024
679
5343
9918
5841
1311
2024
9345
79
2760
704
5619
4334
2451
8862
5294
3571
6549
5939
9021
8996
2324
5371
1439
13503
3135
3548
5563
1577
4287
3656
1016
7549
3580

result:

ok 50 lines

Test #22:

score: 15
Accepted
time: 119ms
memory: 10740kb

input:

100000 20000 50
20000
19999
19999
11771
15039
19999
15800
13126
19997
19997
14925
19997
19997
19997
19997
15396
19997
19997
19382
19995
19995
19995
19995
19995
19995
17939
19995
19993
19993
19993
19993
19993
15292
19993
19993
16823
19991
15117
15824
19991
19991
19742
12374
19989
19987
19987
19987
19...

output:

10506
9972
7125
12749
3527
3907
9799
3269
9484
4446
6302
686
6645
6572
1234
14344
11329
9423
844
802
4003
10005
6738
1394
811
9437
3159
158
2377
1985
768
13808
2263
7257
1102
12069
6736
2108
13371
244
6867
51
2972
502
788
4258
1730
5267
7201
9111

result:

ok 50 lines

Test #23:

score: 15
Accepted
time: 123ms
memory: 10804kb

input:

100000 100000 50
100000
99999
99999
59766
99999
99999
99999
70484
95515
99999
99997
76492
99997
99997
99997
99995
99995
99995
76093
99995
99995
99995
99995
99993
68766
99993
83484
99991
99991
99991
99991
99991
99989
99989
99989
95161
87092
99987
99987
99987
99985
99985
99985
99983
99983
99983
99983
...

output:

9534
1930
6161
63
1724
6602
738
41
1408
4626
346
6821
8185
2142
4602
7672
9
7478
9590
2859
11237
10321
3463
979
110
7685
11565
5902
1736
9594
6814
617
2656
7156
6637
2297
6397
1400
4732
9567
899
2911
7977
3854
3819
11422
2886
10876
71
2617

result:

ok 50 lines

Test #24:

score: 15
Accepted
time: 118ms
memory: 10812kb

input:

100000 40000 50
40000
27735
39999
39999
39999
30089
39997
27533
39997
39545
39997
39997
24354
39997
39997
27224
39995
39995
39995
39995
39993
39993
39993
39993
34655
25979
39991
39991
39991
39989
32792
39989
36957
39989
39987
39987
26138
39987
29470
39987
33306
39987
34758
39985
39985
39985
39985
39...

output:

2514
7015
10860
5932
13900
2163
1428
2507
10389
2343
4686
7003
3289
8271
1376
4061
809
7390
3003
7079
5581
12266
747
5123
3280
4452
1407
9561
3094
4738
8026
1539
4911
3536
2790
8421
775
3573
10234
2875
5141
9477
1754
9083
10285
10589
2100
10535
1105
3392

result:

ok 50 lines

Test #25:

score: 15
Accepted
time: 122ms
memory: 10712kb

input:

100000 20000 50
20000
11142
19999
19999
19997
19997
19997
17756
19995
19995
19995
12835
18839
10465
19995
13346
19995
19993
19993
19993
19993
19993
19993
15061
13380
19991
16895
19991
15093
12347
19991
19989
19989
19989
19696
19989
19989
19989
19987
19987
19987
14062
19987
19987
19533
19985
18678
19...

output:

5625
7813
1921
1346
5823
2760
481
12722
3312
1069
1873
4450
3293
1785
10
12760
8129
6284
582
213
2417
8790
400
2159
2813
3450
10101
1990
190
1230
5868
4487
9615
1468
4713
9995
11318
6062
4657
2159
10995
3946
3077
11956
10209
7994
2029
11532
6120
6191

result:

ok 50 lines

Test #26:

score: 15
Accepted
time: 143ms
memory: 10800kb

input:

100000 100000 50
100000
99991
99989
99990
99992
99993
99991
99992
99990
99991
99994
99991
99992
99989
99990
99991
99993
99991
99989
99990
99992
99991
99990
99995
99987
99988
99985
99986
99985
99983
99984
99987
99989
99990
99988
99989
99991
99989
99990
99992
99988
99989
99987
99985
99986
99988
99990
...

output:

14
10
12
15
15
11
16
15
13
14
11
15
13
19
14
14
17
14
14
13
11
16
13
13
15
17
13
8
14
15
10
11
14
7
17
12
10
10
4
10
10
11
10
15
10
11
11
12
15
13

result:

ok 50 lines

Test #27:

score: 15
Accepted
time: 145ms
memory: 10764kb

input:

100000 100000 50
100000
99990
99991
99989
99988
99990
99989
99988
99992
99989
99990
99991
99993
99987
99986
99988
99989
99986
99987
99985
99986
99988
99984
99985
99986
99987
99986
99990
99987
99986
99985
99984
99988
99986
99987
99989
99986
99987
99988
99986
99985
99987
99985
99986
99991
99990
99992
...

output:

15
11
19
12
8
13
13
14
17
14
10
14
11
12
11
11
13
12
12
17
11
14
11
15
10
12
12
9
10
6
13
11
7
9
20
12
14
15
14
13
13
10
14
11
14
14
4
13
11
6

result:

ok 50 lines

Test #28:

score: 15
Accepted
time: 61ms
memory: 10292kb

input:

100000 100000 50
100000
2
50010
4
5
6
7
8
9
10
11
3861
13
41123
15
16
17
18
19
20
21
22
23
24
25
26
27
28
3182
30
31
32
33
34
35
36
37
38
94545
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
59849
63
64
87129
66
67
68
52693
5951
71
72
73
74
75
76
77
78
79
80
84907
82
83
84
85
86
8...

output:

11
10
13
9
10
12
12
10
11
10
13
12
12
11
11
14
11
9
10
7
11
11
13
4
9
11
15
6
12
12
9
10
15
9
9
7
12
11
12
11
5
13
12
7
8
10
5
13
13
12

result:

ok 50 lines

Subtask #3:

score: 0
Time Limit Exceeded

Dependency #1:

100%
Accepted

Test #29:

score: 0
Time Limit Exceeded

input:

100000 14 100000
14
13
9
6
8
12
6
8
14
12
6
5
6
4
10
8
11
1
14
12
4
3
3
13
10
4
3
1
1
1
2
10
1
3
6
3
8
13
14
4
9
13
13
12
13
8
4
7
5
1
14
3
4
6
2
4
7
9
4
10
7
8
7
13
6
2
7
14
2
13
10
1
14
5
1
14
9
14
11
4
7
12
5
13
13
7
3
9
6
4
3
9
7
7
5
10
9
6
1
14
11
14
10
8
7
5
14
12
12
4
2
13
11
1
6
6
12
1
2
8
4...

output:


result:


Subtask #4:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%