QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#608626#382. 整数3un_larryfunc100 ✓459ms23912kbC++172.2kb2024-10-04 00:09:392024-10-04 00:09:41

詳細信息


Pretests


Final Tests

Test #1:

score: 4
Accepted
time: 1ms
memory: 5736kb

input:

10 3 1 2
1 383358154 29
2 9
2 28
1 26618486 16
2 8
2 12
1 602476135 11
2 2
2 18
2 3

output:

0
0
0
0
0
0
0

result:

ok 7 lines

Test #2:

score: 4
Accepted
time: 0ms
memory: 3700kb

input:

100 3 2 2
1 360073693 97
1 234679395 99
1 237179529 99
1 67107048 7
2 89
1 868206567 6
2 88
1 544418082 99
2 21
2 82
1 -426340526 50
2 52
2 68
1 -603655988 13
2 49
2 85
1 275336702 56
1 534927378 69
2 93
2 18
1 635664838 39
1 -591394081 43
2 82
1 333082651 84
2 3
1 -714786852 68
2 73
1 833274502 34
...

output:

0
0
1
0
0
1
1
1
1
1
0
0
1
1
1
1
0
0
0
0
1
0
1
1
1
1
0
0
0
0
0
0
0
1
1
1
0
1
1
0
1
0
1
1
1
1
0
0
0
1
0
0
0
0
0

result:

ok 55 lines

Test #3:

score: 4
Accepted
time: 0ms
memory: 3724kb

input:

2000 3 2 2
1 72379097 98
2 6
1 -202429059 9
1 -899150034 6
2 5
2 21
1 784235101 100
2 59
2 0
2 95
1 -605183513 3
2 57
1 881796472 95
2 82
1 593783579 3
1 573261565 5
2 5
1 -986931095 6
1 309623601 95
2 96
1 145184890 98
2 32
1 81223866 95
1 5029294 95
2 6
1 975641520 95
2 64
2 46
1 927233882 95
2 33...

output:

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

result:

ok 1017 lines

Test #4:

score: 4
Accepted
time: 0ms
memory: 5664kb

input:

4000 1 3 2
1 1 3706
1 1 1338
1 1 3130
1 1 2494
2 991
2 3714
1 1 2270
2 1450
1 1 2054
2 579
1 1 1108
1 1 1399
1 1 1779
2 1271
2 1101
2 914
2 1136
1 1 3800
1 1 2197
1 1 3847
1 1 446
2 2496
1 1 2686
2 2083
2 1499
2 1558
1 1 1797
1 1 3218
2 604
1 1 233
1 1 1443
2 3884
2 3778
1 1 4000
1 1 3876
1 1 3595
1...

output:

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

result:

ok 1988 lines

Test #5:

score: 4
Accepted
time: 1ms
memory: 3692kb

input:

6000 3 3 1
1 15625038 5904
1 501632848 5912
1 181790794 5810
1 543777945 5754
1 -824818493 357
1 386863265 5969
1 690990981 505
1 92364782 5978
1 -60495121 472
1 568496931 462
1 258943761 5902
1 659292189 5956
1 453814624 5703
1 412105292 5794
1 769240761 5704
1 191286201 151
1 408838846 5981
1 6875...

output:

1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
0
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
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
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
0
1
1
...

result:

ok 1500 lines

Test #6:

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

input:

8000 2 3 2
1 1 7707
1 1 7751
1 1 633
1 1 7807
1 1 7957
1 1 7759
2 1626
2 7717
2 7833
1 -1 150
2 3790
1 1 7739
2 1391
2 4334
2 2317
1 -1 717
2 3857
1 1 7842
2 45
1 1 7916
2 5252
1 1 7813
2 3890
1 1 391
1 1 7683
2 4659
2 2730
2 5381
2 5712
1 1 7956
1 1 7785
1 -1 443
1 1 7655
2 1890
2 1157
2 1734
1 1 7...

output:

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

result:

ok 2410 lines

Test #7:

score: 4
Accepted
time: 2ms
memory: 5816kb

input:

9000 3 4 2
1 517454227 265601
1 609919107 8564
2 53667
1 -923455175 26346
2 252643
1 -985960328 6771
1 -590433109 7070
2 227917
2 230378
1 -446993811 1522
2 119461
1 394717935 260759
2 155619
2 269175
2 257810
1 405979004 22009
1 73061676 257266
1 -250422043 25333
1 -117088881 25484
2 45366
1 -48854...

output:

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

result:

ok 2752 lines

Test #8:

score: 4
Accepted
time: 2ms
memory: 5608kb

input:

10000 3 3 2
1 320151315 9958
2 9288
2 7773
1 916567623 818
1 482102154 1
2 8459
1 153956549 9633
2 7864
2 8160
1 -762325137 898
1 585485812 9633
2 5878
2 7821
1 277816195 224
1 826766551 9608
2 6081
2 2301
1 994517804 9606
1 -988221640 488
2 452
1 802966342 9746
2 4836
1 -318876939 376
2 4231
1 8145...

output:

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

result:

ok 3080 lines

Test #9:

score: 4
Accepted
time: 5ms
memory: 6236kb

input:

30000 3 4 2
1 507318972 886321
2 484942
2 494102
2 788085
1 148942627 893597
2 474042
2 15178
2 93984
1 323003361 48797
2 392258
1 163318500 17194
2 112225
2 686012
2 125035
1 405608067 857353
1 310464490 58490
2 398210
1 239129904 867166
2 725800
2 624060
2 349865
1 -296482039 6526
2 676269
2 68219...

output:

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

result:

ok 9179 lines

Test #10:

score: 4
Accepted
time: 3ms
memory: 6728kb

input:

50000 3 4 1
1 680255497 1465078
1 117153157 34600
1 996401170 1444899
1 778641833 111438
1 -540015289 117470
1 578365644 17521
1 143366903 1492702
1 899178127 1435391
1 406596417 1457779
1 288024700 1483738
1 551354850 1466661
1 189535487 1432374
1 -887395339 129051
1 309832169 59688
1 745382428 147...

output:

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

result:

ok 12500 lines

Test #11:

score: 4
Accepted
time: 3ms
memory: 6188kb

input:

60000 3 3 2
1 274233114 59289
1 314318004 58468
1 299492798 59336
2 9582
2 11676
2 35985
1 784750334 58989
1 -840711503 3929
2 25966
2 13964
1 211077925 1734
2 46209
1 121968192 556
1 193915653 58760
1 623769118 58863
1 507815386 2178
2 16557
1 515785168 59246
2 59466
1 416325879 3234
2 24407
1 4376...

output:

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

result:

ok 18450 lines

Test #12:

score: 4
Accepted
time: 8ms
memory: 6976kb

input:

65000 2 4 2
1 1 1938347
1 1 1918180
1 1 39361
1 1 96890
2 1530867
1 1 1862460
2 1749678
2 320437
1 1 1934991
2 1835056
2 55609
1 1 87352
1 1 1860622
2 118557
1 1 63163
1 1 1937993
1 1 97206
1 1 1911460
1 1 94925
1 1 1913223
1 1 139936
1 1 146219
1 1 1886246
1 1 76705
2 1088651
2 956514
2 1176428
1 1...

output:

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

result:

ok 19734 lines

Test #13:

score: 4
Accepted
time: 12ms
memory: 5980kb

input:

70000 3 4 2
1 135855339 2024970
2 1013817
1 343871871 2025958
2 558510
2 931882
1 789122474 2061028
2 421493
1 895828595 128859
1 447478270 2032427
2 1018524
1 536152703 2071193
2 146688
1 111717596 35919
1 631194744 92181
1 23084337 162767
1 760267193 2051437
1 622420793 41615
2 804550
1 160341074 ...

output:

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

result:

ok 21577 lines

Test #14:

score: 4
Accepted
time: 35ms
memory: 10128kb

input:

200000 3 4 2
1 525578445 5979498
2 319586
1 52629754 5766582
1 835442971 5846893
1 -5408484 41941
1 688317592 5779412
1 994118469 5951009
1 313865161 5862353
2 2059987
1 -196449861 441339
1 413556266 5869060
2 2071107
1 -667600330 37152
2 1448877
2 5135707
2 1356627
1 245004568 5992376
2 88982
1 159...

output:

0
1
1
1
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
0
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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 60845 lines

Test #15:

score: 4
Accepted
time: 45ms
memory: 10724kb

input:

300000 2 4 2
1 1 8725737
2 5437959
2 6080216
1 1 8994046
2 5649189
2 730318
1 1 8828336
1 1 8630619
2 7937901
1 1 8553448
2 5300158
2 5738021
1 -1 32511
1 1 8638123
2 6321073
2 7106299
1 1 8663807
2 5663333
2 4794794
2 7224772
2 1656394
1 -1 528286
2 8825535
1 1 391229
2 1744346
2 1875930
1 -1 61522...

output:

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

result:

ok 91298 lines

Test #16:

score: 4
Accepted
time: 83ms
memory: 13912kb

input:

400000 3 4 2
1 360186982 11858132
1 -958446637 8653
1 513221781 11542925
2 6170478
2 5575700
2 8415928
1 687517427 11450381
2 4197548
2 2389828
1 673538262 11937292
1 811805647 584491
1 194023965 1005175
2 1446834
2 3684128
1 -941535026 291714
1 -470368182 468080
2 1801346
2 4835547
1 -511549932 793...

output:

1
1
1
1
1
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
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
0
1
1
1
1
1
0
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
1
0
1
1
1
1
1
1
0
1
0
1
1
1
1
1
0
0
1
1
0
1
...

result:

ok 121542 lines

Test #17:

score: 4
Accepted
time: 63ms
memory: 5492kb

input:

500000 3 3 2
1 957292743 480490
2 15677
1 816759942 499889
1 227039633 476542
1 -936175663 32097
2 329082
1 716090228 39455
2 18920
2 419822
1 24739287 485759
2 195999
2 279991
1 -326964512 31705
2 76282
1 250816927 480358
1 -220657959 25412
2 105475
2 474934
1 543227151 49527
1 -686359143 41845
1 4...

output:

0
1
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
0
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
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
...

result:

ok 152674 lines

Test #18:

score: 4
Accepted
time: 138ms
memory: 16172kb

input:

600000 3 4 2
1 914891263 17830219
1 513861059 17795757
1 -658344196 1627086
1 -725067082 355784
2 11556050
1 955442958 1411754
2 1979838
2 3463308
1 29163960 1758835
1 770671714 17945132
1 -153163626 1125076
1 -95157740 1256242
1 366174676 17573072
1 863835769 17392979
2 8018668
2 8611753
2 753186
2...

output:

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

result:

ok 182584 lines

Test #19:

score: 4
Accepted
time: 170ms
memory: 19444kb

input:

700000 3 4 2
1 618501580 20793118
1 864180367 20091232
2 16538754
2 952998
1 189861313 20424280
1 250186625 20634883
2 17806480
2 7439934
2 9018878
1 19813971 1084812
1 444488192 20690387
2 19048192
1 -101385721 300318
1 -164368405 1343989
1 634232943 20998397
1 210899116 20916088
2 18734917
2 11630...

output:

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

result:

ok 213734 lines

Test #20:

score: 4
Accepted
time: 459ms
memory: 22024kb

input:

800000 1 4 2
2 4056921
1 1 6813152
1 1 22587557
2 16452919
2 4086708
1 1 4977181
1 1 16799376
1 1 4245400
1 1 3912617
2 18236243
1 1 18384330
2 9725796
1 1 7999783
1 1 9296214
2 9206554
2 20134208
2 54964
1 1 10183937
1 1 18993144
2 6272354
2 7500402
2 14264324
1 1 14050666
2 22572959
1 1 17363096
1...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 400336 lines

Test #21:

score: 4
Accepted
time: 185ms
memory: 17640kb

input:

900000 2 4 2
1 1 26374128
1 1 390962
2 12873048
1 -1 1393720
1 -1 1586993
2 652732
1 -1 985178
1 -1 1892326
1 1 25693883
2 6377669
2 11916971
2 14888004
1 1 25753422
2 5078297
2 13653423
2 275798
2 10706326
2 9735730
1 1 26138748
2 23598397
1 1 26549688
2 10859618
2 9261494
2 10607362
1 1 26189697
1...

output:

0
0
1
1
1
1
1
0
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
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
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
...

result:

ok 274924 lines

Test #22:

score: 4
Accepted
time: 121ms
memory: 7668kb

input:

930000 3 3 2
1 552629481 914382
2 865900
2 69994
1 -669853080 75969
2 151837
2 824233
2 512355
2 865839
2 7246
2 59782
2 329126
1 116910586 921065
1 -343824032 62456
1 -902484453 3650
1 11625784 29702
1 476367300 925907
1 666505316 899886
2 449485
2 121107
1 247086115 884755
2 22943
2 907817
2 10459...

output:

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

result:

ok 283182 lines

Test #23:

score: 4
Accepted
time: 152ms
memory: 10340kb

input:

960000 3 4 1
1 972494419 28583169
1 -378238044 2509578
1 179762862 2389384
1 331881410 28242248
1 973778358 28510521
1 -488169700 390288
1 662018488 1202257
1 917340310 357746
1 616792560 2269740
1 472217090 2631445
1 -33160943 1645282
1 -968937518 1507430
1 -769891614 2730645
1 367345177 1690324
1 ...

output:

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
0
1
0
0
0
1
1
1
1
1
1
1
0
1
1
1
1
0
1
1
1
1
1
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
0
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
...

result:

ok 240000 lines

Test #24:

score: 4
Accepted
time: 134ms
memory: 6324kb

input:

990000 3 3 2
1 112160968 952102
1 -428117598 48440
1 893426864 980996
2 550192
2 475671
1 931470880 973373
2 77244
1 -745411082 27932
1 726917750 975625
1 743124245 64979
1 -163971422 490
2 136839
2 59564
2 136323
2 678217
1 857750237 33229
2 257233
2 838660
2 904795
1 783338887 955545
2 111225
1 -9...

output:

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

result:

ok 302614 lines

Test #25:

score: 4
Accepted
time: 264ms
memory: 23912kb

input:

1000000 3 4 2
1 306388415 29863087
1 473800892 1846772
1 634901198 28984124
2 14391742
1 61597217 1654030
2 3884203
1 819359586 1206402
2 1360627
2 27549
2 28347136
1 -473472540 2893782
1 190783941 29459037
2 3964262
1 193110030 29333081
2 17246638
2 27653829
1 421826823 1125895
2 16299325
2 6577218...

output:

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

result:

ok 304993 lines

Extra Test:

score: 0
Extra Test Passed