QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#143814#4188. Excursion to PorvooMaMengQiAC ✓74ms16284kbC++201.8kb2023-08-21 14:47:372023-08-21 14:47:42

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3500kb

input:

2 2
1 100 300
1 1 30
5
400
500
300
20
1

output:

impossible
impossible
100
1
1

result:

ok 5 lines

Test #2:

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

input:

5 7
1 200 30
2 200 31
3 200 32
4 200 33
1 5000 33
2 5000 33
3 5000 33
3
30
31
33

output:

800
5600
15200

result:

ok 3 lines

Test #3:

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

input:

2 3
1 3 3
1 4 2
1 2 1
3
1
3
2

output:

2
3
3

result:

ok 3 lines

Test #4:

score: 0
Accepted
time: 62ms
memory: 16240kb

input:

100000 99999
1 8793 670998
2 3301 949483
3 5662 542705
4 3033 907487
5 7035 366434
6 5771 1750
7 2575 80336
8 5163 613257
9 5748 414726
10 4990 119039
11 5855 239538
12 1965 755221
13 8891 149341
14 3213 674329
15 9189 660274
16 4593 513364
17 793 326875
18 2873 954337
19 3470 105349
20 9374 779965
...

output:

impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
imp...

result:

ok 100000 lines

Test #5:

score: 0
Accepted
time: 61ms
memory: 16188kb

input:

100000 99999
1 3240 695579
2 385 552750
3 7763 316283
4 6298 391224
5 9171 441170
6 4647 574157
7 3537 767389
8 9359 115301
9 2611 186845
10 3412 270551
11 1631 147510
12 8359 47455
13 6196 156351
14 2211 798509
15 1233 65941
16 9084 530631
17 9554 349540
18 7990 248755
19 5648 182526
20 6027 579169...

output:

impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
imp...

result:

ok 100000 lines

Test #6:

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

input:

100000 99999
1 4493 1000000
2 7727 1000000
3 6145 1000000
4 4865 1000000
5 9695 1000000
6 5798 1000000
7 4753 1000000
8 8634 1000000
9 2508 1000000
10 7667 1000000
11 9516 1000000
12 8464 1000000
13 6427 1000000
14 2965 1000000
15 6283 1000000
16 6283 1000000
17 5820 1000000
18 6064 1000000
19 5782 ...

output:

impossible
impossible
impossible
impossible
impossible
500615062
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impo...

result:

ok 100000 lines

Test #7:

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

input:

2 2
1 1 1
1 2 2
2
2
1

output:

2
1

result:

ok 2 lines

Test #8:

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

input:

2 2
1 2 1
1 1 2
2
2
1

output:

1
1

result:

ok 2 lines

Test #9:

score: 0
Accepted
time: 34ms
memory: 7064kb

input:

100000 99999
62085 7710 1000000
54476 6395 1000000
50744 8690 1000000
59096 7746 1000000
85894 6000 1000000
9112 5240 810968
9921 9917 882969
37118 6732 1000000
47517 3970 1000000
34037 669 1000000
40653 5674 1000000
77749 3030 1000000
23864 2585 1000000
25451 6277 1000000
17532 9729 1000000
3497 93...

output:

impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
500574229
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impo...

result:

ok 100000 lines

Test #10:

score: 0
Accepted
time: 35ms
memory: 7232kb

input:

100000 99999
39660 9302 1000000
98071 2713 1000000
72323 3720 1000000
71796 8998 1000000
40049 3610 1000000
8898 4563 791922
22165 8348 1000000
50925 2575 1000000
83758 7014 1000000
73270 8365 1000000
8646 7417 769494
9949 8258 885461
93723 6162 1000000
10594 6944 942866
23413 1759 1000000
80951 492...

output:

impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
499...

result:

ok 100000 lines

Test #11:

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

input:

100000 99999
24455 6930 1000000
15633 9343 1000000
23527 1314 1000000
81866 1685 1000000
68810 6056 1000000
80851 3281 1000000
21278 2071 1000000
22597 5806 1000000
62066 8104 1000000
89599 1569 1000000
24495 2016 1000000
97826 3342 1000000
15282 575 1000000
45817 7247 1000000
75986 435 1000000
6882...

output:

impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
499837192
impossible
impossible
impossible
499837192
impossible
499837192
impossible
impossible
impossible
impossible
impossible
impossible
impossible
imposs...

result:

ok 100000 lines

Test #12:

score: 0
Accepted
time: 64ms
memory: 15452kb

input:

1000 99900
760 1890 909898
887 600 231918
312 960 118146
919 2730 409324
657 1650 646029
686 1140 396945
372 810 793692
415 2580 816520
923 870 961317
438 2190 649931
667 900 456938
41 1350 216853
626 150 266679
666 2700 1503
731 3000 653691
214 240 386220
655 2280 847597
761 750 260956
515 240 9304...

output:

31860
32850
32190
32910
32160
31080
31080
30960
30960
32160
30060
32130
32490
30210
30330
30750
32700
31500
31260
30870
32460
30060
30060
31020
32160
29970
31170
30810
31860
31980
32730
33180
30210
31860
31200
32670
32070
32160
31440
31410
29970
31980
32820
32160
32640
32190
31620
31170
30870
31020
...

result:

ok 100000 lines

Test #13:

score: 0
Accepted
time: 66ms
memory: 16284kb

input:

1000 99900
981 1830 149296
651 2010 78592
577 2760 516976
350 2520 399406
144 2850 870458
151 1950 709294
951 1590 66173
444 1620 979970
106 570 63290
144 900 312032
556 2070 474839
266 2430 391438
586 2100 629949
967 2910 196118
521 1770 318742
545 1830 121635
655 720 38915
464 1410 402183
466 2820...

output:

30450
30810
31740
31590
32190
31380
31350
30420
30450
31140
30570
32010
32400
31320
30210
32010
31860
32910
30360
30930
30000
32520
32460
30480
30420
30390
32250
32880
32010
31260
32730
30240
31560
30600
30930
30870
30420
30390
31800
32010
31620
30960
31260
30120
30900
31860
32010
31140
30810
31860
...

result:

ok 100000 lines

Test #14:

score: 0
Accepted
time: 72ms
memory: 16028kb

input:

1000 99900
811 720 476394
409 2910 173730
278 2850 310107
214 840 305379
78 150 597814
959 360 443926
791 2490 737660
751 2610 40326
462 2490 40574
763 30 308205
88 300 881962
367 2220 613521
931 1470 932507
137 1920 803799
447 2010 257973
440 480 612258
805 2700 675121
848 1620 894344
381 2610 9084...

output:

31110
31470
30240
31620
30600
31830
31260
32310
32430
32520
32640
31620
30360
32820
31080
30570
31350
32430
31470
31380
32640
31650
31890
30240
31470
30810
32460
30570
31110
32040
31890
30990
30870
32820
31560
30270
30240
30720
32040
31620
31410
30000
32130
31890
32460
32820
30300
31410
32460
32760
...

result:

ok 100000 lines

Test #15:

score: 0
Accepted
time: 74ms
memory: 16004kb

input:

3 100000
1 785 88182
1 227 99497
1 861 83488
1 990 40994
1 658 16959
1 898 21641
1 546 33395
1 66 29866
1 183 48964
1 277 18531
1 416 63003
1 464 88128
1 451 33423
1 408 7296
1 440 46240
1 756 95948
1 494 94736
1 798 83156
1 788 92793
1 502 44903
1 959 73635
1 948 22365
1 937 30888
1 100 88042
1 308...

output:

10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
10004
...

result:

ok 100000 lines

Test #16:

score: 0
Accepted
time: 63ms
memory: 10472kb

input:

5 100000
1 666 39152
2 958 37270
2 872 28330
1 861 193
2 258 35537
1 708 11060
1 260 5662
2 681 3380
2 543 18894
1 911 46658
1 95 20545
2 153 7651
2 586 43066
1 675 44676
1 436 30429
1 482 21085
1 402 20438
1 10 39342
1 466 26777
1 818 9826
1 817 7587
1 914 32607
2 38 46199
2 994 32014
2 600 24179
1...

output:

impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
imp...

result:

ok 100000 lines

Test #17:

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

input:

3 2
1 1 1
2 1 1
2
4
1

output:

impossible
2

result:

ok 2 lines

Test #18:

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

input:

2 2
1 200 30
1 500 20
2
30
20

output:

200
200

result:

ok 2 lines