QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#533342#1139. StationsMinaRagy06#8 48ms4084kbC++201.1kb2024-08-25 20:35:012024-08-25 20:35:02

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 36ms
memory: 3828kb

input:

0
10
10 1000
4 5
9 0
2 6
5 2
8 3
1 4
8 1
6 0
3 7
3 1000
0 1
1 2
998 1000
166 178
393 452
389 179
622 429
892 866
872 18
899 227
835 637
587 769
504 386
369 577
65 441
523 17
803 221
878 321
637 892
696 473
16 146
840 322
495 986
353 275
330 585
831 402
719 810
704 830
780 940
53 901
894 911
394 482
...

output:

10
0
1
2
3
4
5
6
7
8
9
3
0
1
2
998
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91...

input:

1
59784
0 1 1
1
564 432 2
156
710
0 1 1
1
303 620 2
302
304
3 2 1
2
1 0 1
0
0 1 1
1
980 381 2
82
733
2 0 2
1
3
0 1 1
1
948 832 2
947
949
6 2 2
0
2
505 151 2
251
786
131 800 2
130
132
927 964 2
98
390
570 874 2
569
571
0 1 1
1
78 91 2
33
85
1 2 2
0
2
0 1 1
1
117 822 2
124
961
1 0 1
0
953 952 2
179
78...

output:

1
281
1
151
2
0
1
489
0
1
473
2
252
65
463
284
1
38
0
1
58
0
476
1
1
309
2
0
0
465
75
138
2
2
14
0
68
7
0
1
2
305
452
282
49
8
142
61
420
13
1
366
149
3
1
1
3
377
1
2
0
0
343
142
467
25
471
0
0
475
70
481
111
0
25
386
1
0
382
1
2
86
1
246
1
48
80
250
2
2
1
1
39
2
2
477
170
37
1
401
394
312
0
338
0
3...

result:

wrong answer Diff at 2-th number: read 281 but expected 710

Subtask #2:

score: 8
Accepted

Test #11:

score: 8
Accepted
time: 32ms
memory: 3884kb

input:

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

output:

996
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
10...

input:

1
50252
876 174 1
437
937 71 1
468
508 771 1
253
715 87 1
357
940 154 1
469
721 974 1
360
864 867 1
431
728 899 1
363
433 888 3
216
867
868
235 92 3
117
471
472
508 517 1
253
404 582 3
201
809
810
902 767 1
450
712 486 1
355
655 0 1
327
545 583 1
272
471 488 3
235
943
944
40 666 3
19
81
82
691 417 1...

output:

437
468
253
357
469
360
431
363
216
117
253
201
450
355
327
272
235
82
345
495
489
471
433
35
349
484
307
445
426
59
29
237
448
345
81
382
407
111
330
370
233
357
126
239
178
132
147
106
465
143
147
347
486
268
231
61
338
490
205
155
212
480
302
366
471
417
22
280
321
308
443
106
405
138
14
13
461
3...

result:

ok 

Test #12:

score: 8
Accepted
time: 36ms
memory: 3824kb

input:

0
10
31 1000
0 1
0 2
3 1
4 1
2 5
6 2
7 3
3 8
4 9
4 10
11 5
5 12
13 6
6 14
15 7
16 7
17 8
18 8
9 19
20 9
10 21
22 10
11 23
11 24
12 25
26 12
13 27
28 13
14 29
14 30
128 1000
0 1
2 0
3 1
4 1
5 2
6 2
3 7
8 3
9 4
10 4
11 5
12 5
6 13
6 14
7 15
16 7
17 8
18 8
19 9
20 9
10 21
22 10
11 23
11 24
12 25
26 12
...

output:

31
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
128
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
7...

input:

1
59568
9 6 3
4
19
20
364 647 3
181
729
730
66 52 3
32
133
134
105 454 3
52
211
212
51 98 3
25
103
104
0 2 2
1
2
75 70 1
37
203 28 3
101
407
408
186 208 3
92
373
374
0 1 2
1
2
182 191 3
90
365
366
2 1 1
0
450 54 1
224
2 3 1
0
1 0 1
0
27 21 3
13
55
56
74 43 1
36
121 16 1
60
603 443 1
301
81 82 3
40
1...

output:

4
181
32
52
25
2
37
101
92
1
90
0
224
0
0
13
36
60
301
40
1
4
416
205
19
24
37
0
151
5
0
158
1
1
1
0
214
8
44
247
0
2
102
225
1
0
181
154
3
1
27
7
171
0
1
63
1
10
0
22
0
0
376
51
0
217
215
3
23
17
1
0
10
95
0
1
57
235
163
254
0
2
116
493
0
11
379
1
20
25
9
0
144
12
4
1
495
18
52
12
97
4
251
253
369
...

result:

ok 

Test #13:

score: 8
Accepted
time: 48ms
memory: 3800kb

input:

0
10
2 1000
1 0
2 1000
0 1
2 1000
0 1
2 1000
1 0
2 1000
0 1
2 1000
0 1
2 1000
0 1
2 1000
1 0
2 1000
1 0
2 1000
1 0

output:

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

input:

1
100000
0 1 1
1
1 0 1
0
1 0 1
0
0 1 1
1
0 1 1
1
1 0 1
0
1 0 1
0
0 1 1
1
1 0 1
0
1 0 1
0
1 0 1
0
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
1
0
1
0
1
2
0
1
0
3
0
0
2
0
1
1
2
1
1
2
3
3
2
1
0
1
1
3
1
0
0
0
0
1
0
1
0
1
0
1
0
0
2
3
0
1
0
1
0
2
2
0
0
3
1
1
1
0
0
0
1
1
1
0
3
0
1
0
1
3
2
0
1
0
1
2
1
1
3
0
1
1
0
0
2
3
1
0
2
0
2
0
1
0
1
1
0
0
1
0
0
1
1
1
2
1
0
0
0
3
1
1
3
0
0
1
0
2
1
2
1
2
1
2
1
0
...

result:

ok 

Test #16:

score: 8
Accepted
time: 32ms
memory: 3804kb

input:

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

output:

1000
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
1...

input:

1
50108
40 278 3
19
81
82
7 453 3
3
15
16
84 611 3
41
169
170
153 633 3
76
307
308
873 763 1
436
654 851 1
326
191 619 3
95
383
384
964 168 1
481
602 471 1
300
253 822 3
126
507
508
325 818 3
162
651
652
372 476 3
185
745
746
747 109 1
373
86 64 3
42
173
174
298 932 3
148
597
598
648 954 1
323
866 6...

output:

19
3
41
76
436
326
95
481
300
126
162
185
373
42
148
323
432
416
86
22
147
352
357
205
153
245
107
101
278
456
477
4
70
294
446
68
485
38
441
412
272
67
110
137
326
206
353
327
240
109
460
307
196
180
460
265
14
125
413
307
309
468
152
202
145
426
24
94
130
169
454
251
105
225
211
82
338
330
108
75
...

result:

ok 

Subtask #3:

score: 0
Wrong Answer

Test #17:

score: 0
Wrong Answer
time: 38ms
memory: 3796kb

input:

0
10
2 1000000
1 0
997 1000000
830 513
223 672
727 200
763 415
581 440
34 42
267 325
912 693
753 59
401 289
198 641
982 214
41 49
453 107
940 806
905 732
153 482
248 405
102 79
480 837
534 620
564 856
679 178
278 247
899 206
333 672
297 308
407 863
26 752
272 178
204 603
208 10
715 562
785 285
184 5...

output:

2
0
1
997
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
...

input:

1
59859
4 7 2
0
3
1 0 1
0
1 0 1
0
31 85 2
30
32
759 223 2
528
969
759 960 2
237
627
0 1 1
1
1 0 2
2
5
122 328 2
121
123
0 1 1
1
0 1 1
1
1 0 1
0
1 2 2
0
2
838 639 2
275
593
371 213 2
370
372
511 503 2
510
512
9 5 2
3
8
2 1 1
1
741 442 2
539
861
69 96 2
19
53
989 291 2
580
804
836 205 2
682
782
773 72...

output:

1
0
0
15
379
379
1
0
60
1
1
0
0
418
185
255
4
1
370
34
494
417
386
239
0
450
167
134
1
3
94
1
128
1
0
0
89
162
493
0
108
138
374
321
8
1
59
7
147
0
378
1
178
45
48
43
1
48
0
0
1
1
1
1
430
415
17
1
159
0
133
447
11
0
312
3
441
376
0
258
1
107
259
1
1
20
1
106
1
346
22
0
1
1
462
7
1
1
495
1
452
0
473
...

result:

wrong answer Diff at 1-th number: read 1 but expected 3

Subtask #4:

score: 0
Wrong Answer

Test #34:

score: 10
Accepted
time: 48ms
memory: 4084kb

input:

0
10
2 1000000000
0 1
2 1000000000
0 1
2 1000000000
1 0
2 1000000000
1 0
2 1000000000
0 1
2 1000000000
1 0
2 1000000000
1 0
2 1000000000
0 1
2 1000000000
0 1
2 1000000000
0 1

output:

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

input:

1
100000
1 0 1
0
0 1 1
1
0 1 1
1
1 0 1
0
0 1 1
1
1 0 1
0
1 0 1
0
1 0 1
0
1 0 1
0
1 0 1
0
0 1 1
1
1 0 1
0
0 1 1
1
1 0 1
0
0 1 1
1
0 1 1
1
0 1 1
1
1 0 1
0
1 0 1
0
0 1 1
1
1 0 1
0
0 1 1
1
0 1 1
1
1 0 1
0
1 0 1
0
0 1 1
1
0 1 1
1
1 0 1
0
0 1 1
1
0 1 1
1
1 0 1
0
1 0 1
0
1 0 1
0
1 0 1
0
1 0 1
0
0 1 1
1
1 0...

output:

0
1
1
0
1
0
0
0
0
0
1
0
1
0
1
1
1
0
0
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
0
1
0
1
0
0
0
1
1
0
1
1
1
1
0
0
1
1
0
0
0
1
1
0
1
1
0
1
1
0
0
0
1
0
1
1
1
1
1
1
0
1
0
1
1
1
0
0
0
0
1
0
0
1
0
1
1
0
1
1
1
0
0
0
1
1
1
0
1
0
0
1
0
1
0
1
1
0
0
1
0
0
0
1
1
1
0
0
0
1
1
0
0
1
1
1
0
1
0
1
0
1
1
1
1
0
0
0
0
1
0
0
1
0
0
0
...

result:

ok 

Test #35:

score: 0
Wrong Answer
time: 42ms
memory: 3880kb

input:

0
10
3 1000000000
2 1
2 0
3 1000000000
1 0
2 0
3 1000000000
2 0
0 1
3 1000000000
0 2
1 2
3 1000000000
1 2
1 0
3 1000000000
1 0
2 1
3 1000000000
0 2
1 2
3 1000000000
1 2
1 0
3 1000000000
0 2
1 0
3 1000000000
2 0
1 2

output:

3
0
1
2
3
0
1
2
3
0
1
2
3
0
1
2
3
0
1
2
3
0
1
2
3
0
1
2
3
0
1
2
3
0
1
2
3
0
1
2

input:

1
75069
1 2 2
0
2
0 2 2
1
2
0 2 1
1
0 2 1
1
2 0 1
0
0 1 1
2
1 2 1
2
2 0 2
0
1
2 1 1
0
1 2 2
0
2
1 2 2
0
2
1 0 1
2
1 2 2
0
2
1 2 2
0
2
2 0 1
1
0 2 1
1
1 0 2
0
2
0 2 2
1
2
0 2 1
2
1 2 1
2
2 1 2
0
1
2 1 2
0
1
1 0 1
0
1 2 1
2
0 2 1
2
1 0 1
2
0 2 1
2
2 0 1
0
1 0 1
2
1 0 2
0
2
2 1 2
0
1
0 2 2
1
2
2 0 2
0
...

output:

0
2
1
1
0
2
2
0
0
0
0
2
0
0
1
1
0
2
2
2
0
0
0
2
2
2
2
0
2
0
0
2
0
2
0
2
0
1
1
0
2
1
0
1
0
0
2
1
0
0
1
0
0
1
1
1
2
1
0
2
0
2
2
0
0
0
0
1
0
1
0
2
2
2
0
2
0
0
0
1
0
0
2
0
0
0
0
2
1
0
1
2
2
0
0
2
0
0
0
1
0
0
2
0
0
0
0
1
2
0
0
1
2
0
1
1
0
2
1
1
2
0
2
1
0
1
2
1
0
0
2
0
2
0
0
1
2
0
1
1
0
2
1
1
0
0
0
1
2
1
...

result:

wrong answer Diff at 1-th number: read 0 but expected 2

Subtask #5:

score: 0
Wrong Answer

Test #54:

score: 0
Wrong Answer
time: 30ms
memory: 3820kb

input:

0
10
3 1000000000
1 0
2 1
998 1000000000
928 443
90 795
55 379
957 417
759 300
960 136
309 858
833 370
228 827
876 955
619 365
15 108
243 388
54 925
141 894
272 634
0 989
600 346
380 277
350 113
326 613
975 946
660 98
34 538
220 864
9 585
185 860
458 424
509 14
22 275
109 872
153 233
76 834
972 736
...

output:

3
0
1
2
998
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
9...

input:

1
59797
2 3 2
1
3
661 819 2
33
571
1 0 1
0
66 46 2
73
82
521 664 2
195
865
1 0 2
0
2
1 3 2
0
2
155 678 2
584
628
70 125 2
55
796
958 547 2
37
500
0 1 1
1
237 589 2
418
886
25 605 2
537
570
756 219 2
264
618
1 0 2
0
2
506 607 2
365
676
515 917 2
514
516
16 13 2
31
74
7 4 2
4
5
175 645 2
174
176
942 1...

output:

0
330
0
32
260
0
3
77
34
478
1
118
12
377
0
252
257
7
3
87
470
0
0
187
98
452
292
138
38
1
0
106
468
1
256
48
239
291
38
0
1
1
228
162
0
235
346
93
480
7
1
421
156
0
4
377
357
1
49
1
0
107
3
1
300
114
1
101
403
9
37
75
98
413
86
237
0
461
421
307
1
223
1
0
3
430
445
323
1
0
283
1
7
279
0
1
489
331
1...

result:

wrong answer Diff at 1-th number: read 0 but expected 3