QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#681096#371. Dragon 2yellowbird100 ✓2410ms15280kbC++201.2kb2024-10-27 00:55:582024-10-27 00:56:00

詳細信息

Subtask #1:

score: 15
Accepted

Test #1:

score: 15
Accepted
time: 10ms
memory: 5976kb

input:

3000 2
-1000000000 481765933 1
85377743 270216262 2
191391529 -187330300 2
-446524492 -554650248 1
344887256 -269582744 2
812158119 -852300289 1
-119731649 889772843 1
-313921295 -894245893 1
-817453607 949118330 1
-779862634 979932169 1
89957932 873226917 2
-284330153 486937972 2
196032868 -2227930...

output:

974160

result:

ok single line: '974160'

Test #2:

score: 15
Accepted
time: 10ms
memory: 6000kb

input:

3000 10
454995909 552778863 4
-210497659 -567186910 4
-149256967 806266174 3
398876492 -681512047 10
-998780686 824474572 1
-426233826 536438524 9
947331654 503750783 3
-362386629 131251232 7
550217934 -782408234 7
-113875321 128351328 10
-719722232 -941688151 2
182053302 -929370960 2
717042915 5481...

output:

24101
22572
22665
25616
22069
24872
23814
23952
21714
21636
23421
22429
21796
20745
24415
24463
25754
25737
22364
23397
21372
30270
22970
23012
26240
25012
27041
24097
23515
21997
22128
23015
22285
21085
21628
23835
21889
22656
28002
22573
26260
24962
24857
22414
20974
22046
20851
22893
25872
25525

result:

ok 50 lines

Test #3:

score: 15
Accepted
time: 21ms
memory: 6284kb

input:

3000 100
428851088 702054396 19
-525170042 396247145 54
-243743831 -933748336 82
682384023 538552216 98
-998281968 -962774882 71
-944719834 978165772 17
-295469066 -266314090 98
501284690 -2293226 12
-431212444 -193951464 58
-903353350 -250676155 34
403494299 -463083726 52
98083033 -45646463 92
-921...

output:

424
491
346
334
328
464
480
668
286
472
353
262
400
498
335
225
514
427
326
611
384
310
227
401
474
414
373
336
456
462
244
513
644
323
446
467
496
429
430
421
648
446
455
328
359
279
510
478
319
425
410
249
409
492
461
415
567
326
282
355
229
200
541
462
384
252
360
389
313
328
321
504
411
471
194
...

result:

ok 5000 lines

Test #4:

score: 15
Accepted
time: 59ms
memory: 12168kb

input:

3000 1000
333196301 521366646 504
114242076 -855550244 364
536282632 -758186317 301
737137962 -946987051 65
911230864 -916547348 41
243737759 -477229523 125
-280730798 309441708 243
-386673715 287738748 615
-521489253 67468294 906
106006633 -78765321 197
-402879062 718885013 192
157976652 -682445023...

output:

0
0
3
1
2
0
0
4
0
2
0
4
0
10
1
3
0
1
4
0
0
1
0
2
0
0
3
1
3
4
0
0
0
0
0
6
3
2
0
4
0
0
1
5
5
3
0
3
0
0
2
3
0
4
1
2
1
2
3
2
2
2
3
1
0
17
0
0
1
0
0
0
1
2
4
0
0
4
1
2
3
0
1
0
0
1
0
2
0
0
0
1
1
0
1
3
1
0
4
0
2
0
0
5
4
2
1
1
0
3
1
5
0
0
0
3
0
3
0
0
1
1
4
0
0
6
0
1
0
0
3
2
0
0
0
0
1
7
0
0
0
0
4
5
1
0
5
2
0
...

result:

ok 100000 lines

Test #5:

score: 15
Accepted
time: 59ms
memory: 12256kb

input:

3000 3000
-86691224 511797686 438
734751309 926576408 822
370074906 -607943141 2820
-276374991 123399205 2333
-102016575 841656841 2860
-933725582 848068363 1581
-931438801 393905578 487
-395935769 -388344624 1118
118112555 541809669 907
600738525 -591468426 2411
317630515 780446398 1432
-599265684 ...

output:

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

result:

ok 100000 lines

Test #6:

score: 15
Accepted
time: 2ms
memory: 6224kb

input:

3000 3000
889772843 -313921295 1
-58375185 -658144768 2
-894245892 -817453607 3
-904283443 -834779825 4
979932169 89957932 5
-594438487 -776737307 6
873226917 -284330153 7
28612342 -607016731 8
-222793020 -931293777 9
-940199747 -994713571 10
-71873449 301950427 11
-530978792 -342069935 12
840579929...

output:

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

result:

ok 1500 lines

Test #7:

score: 15
Accepted
time: 2ms
memory: 6128kb

input:

3000 3000
889772843 -313921295 1
-58375185 -658144768 2
-894245892 -817453607 3
-904283443 -834779825 4
979932169 89957932 5
-594438487 -776737307 6
873226917 -284330153 7
28612342 -607016731 8
-222793020 -931293777 9
-940199747 -994713571 10
-71873449 301950427 11
-530978792 -342069935 12
840579929...

output:

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

result:

ok 1500 lines

Test #8:

score: 15
Accepted
time: 6ms
memory: 5888kb

input:

3000 2
-849669497 -707398637 2
639893300 33742064 1
-944773960 -964912876 2
-770901758 -3521386 2
648960905 828156196 1
113750191 -802078017 2
761298179 -573825924 2
-349862380 -368901742 2
187294908 57142734 1
204554478 457493106 1
292281241 -451960647 2
-118009426 -385777341 2
-912961149 -20081164...

output:

2241536

result:

ok single line: '2241536'

Test #9:

score: 15
Accepted
time: 5ms
memory: 5888kb

input:

3000 2
-1501 2253001 1
-1500 2250000 1
-1499 2247001 1
-1498 2244004 1
-1497 2241009 1
-1496 2238016 1
-1495 2235025 1
-1494 2232036 1
-1493 2229049 1
-1492 2226064 1
-1491 2223081 1
-1490 2220100 1
-1489 2217121 1
-1488 2214144 1
-1487 2211169 1
-1486 2208196 1
-1485 2205225 1
-1484 2202256 1
-1483...

output:

1125000

result:

ok single line: '1125000'

Test #10:

score: 15
Accepted
time: 5ms
memory: 5984kb

input:

3000 2
-1501 2253001 1
-1500 2250000 1
-1499 2247001 1
-1498 2244004 1
-1497 2241009 1
-1496 2238016 1
-1495 2235025 1
-1494 2232036 1
-1493 2229049 1
-1492 2226064 1
-1491 2223081 1
-1490 2220100 1
-1489 2217121 1
-1488 2214144 1
-1487 2211169 1
-1486 2208196 1
-1485 2205225 1
-1484 2202256 1
-1483...

output:

2250000

result:

ok single line: '2250000'

Subtask #2:

score: 45
Accepted

Test #11:

score: 45
Accepted
time: 1031ms
memory: 5996kb

input:

30000 2
-1000000000 481765933 1
85377743 270216262 2
191391529 -187330300 1
-446524492 -554650248 1
344887256 -269582744 2
812158119 -852300289 1
-119731649 889772843 2
-313921295 -894245893 1
-817453607 949118330 2
-779862634 979932169 2
89957932 873226917 2
-284330153 486937972 1
196032868 -222793...

output:

114201625

result:

ok single line: '114201625'

Test #12:

score: 45
Accepted
time: 1916ms
memory: 6116kb

input:

30000 10
-1000000000 481765933 8
85377743 270216262 2
191391529 -187330300 9
-446524492 -554650248 8
344887256 -269582744 10
812158119 -852300289 7
-119731649 889772843 4
-313921295 -894245893 7
-817453607 949118330 6
-779862634 979932169 9
89957932 873226917 4
-284330153 486937972 7
196032868 -2227...

output:

4750004
4741600
4850839
4559225
4843739
4565726
4584873
4562928
4707665
4495167
4638550
4650053
4629921
4499276
4442906
4711781
4476377
4550731
4584559
4507587
4441353
4726927
4600467
4585666
4533180
4586200
4454659
4381064
4498679
4615655
4826412
4559767
4544111
4422259
4627271
4487494
4404832
4423...

result:

ok 50 lines

Test #13:

score: 45
Accepted
time: 35ms
memory: 6212kb

input:

30000 100
939784796 396935811 42
-421865754 -869705880 52
-258329760 -951761039 28
781173223 -79297285 36
435263459 456517962 71
-482943583 151203185 5
499948029 -963908424 69
458479138 -862328430 32
-860458726 -542868912 57
161497742 -51937422 51
975554199 628086945 4
-800176960 -558949521 97
14241...

output:

25285
33718
26848
28851
30750
27097
24628
30367
26648
27903
22747
32640
29882
27372
27096
28294
23433
26665
30142
25127
28985
27555
27652
26064
27607
27738
25614
25139
26184
30938
25775
23833
28194
27661
27060
24701
26221
24440
26786
26109
26273
27061
25346
28510
25446
28262
26900
26172
24854
24149
...

result:

ok 100 lines

Test #14:

score: 45
Accepted
time: 8ms
memory: 8256kb

input:

30000 1000
939784796 396935811 227
-421865754 -869705880 62
-258329760 -951761039 247
781173223 -79297285 403
435263459 456517962 541
-482943583 151203185 813
499948029 -963908424 114
458479138 -862328430 835
-860458726 -542868912 558
161497742 -51937422 566
975554199 628086945 744
-800176960 -55894...

output:

184
198
227
149
350
324
220
288
150
388
204
179
260
170
190
212
292
162
305
236
207
205
159
328
316
169
257
381
149
241
331
267
180
246
420
340
193
270
266
406
292
379
205
255
325
194
201
222
317
349
364
248
221
313
267
202
246
429
252
281
409
479
453
295
394
238
263
160
279
217
336
233
171
340
273
...

result:

ok 100 lines

Test #15:

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

input:

30000 30000
291730505 140550897 1512
140418385 -675533154 15872
932475537 -969615142 766
671105296 -336626937 3671
-452990164 347543569 2359
345539362 -697541269 15621
-335566777 274814346 7358
42012189 -834758196 26338
994682317 -630719833 4558
427414129 -641390965 10428
-624922955 -73766579 7984
-...

output:

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

result:

ok 100 lines

Test #16:

score: 45
Accepted
time: 986ms
memory: 8080kb

input:

30000 2
932757444 812851329 1
-691190593 -710348784 2
-213720716 -518031063 1
-450036883 -662886783 2
-800040425 30935169 1
-965538429 -822325860 2
-762104969 -409750301 1
-707936479 -275350962 2
-331603419 839177873 1
-726837318 -248358273 2
985900155 -274629422 1
68226527 -609819209 2
302741285 -8...

output:

4476

result:

ok single line: '4476'

Test #17:

score: 45
Accepted
time: 997ms
memory: 6152kb

input:

30000 2
932757444 812851329 1
-691190593 -710348784 2
-213720716 -518031063 1
-450036883 -662886783 2
-800040425 30935169 1
-965538429 -822325860 2
-762104969 -409750301 1
-707936479 -275350962 2
-331603419 839177873 1
-726837318 -248358273 2
985900155 -274629422 1
68226527 -609819209 2
302741285 -8...

output:

4476

result:

ok single line: '4476'

Test #18:

score: 45
Accepted
time: 474ms
memory: 6152kb

input:

30000 2
-849669497 -707398637 2
639893300 33742064 1
-944773960 -964912876 2
-770901758 -3521386 2
648960905 828156196 1
113750191 -802078017 2
761298179 -573825924 2
-349862380 -368901742 2
187294908 57142734 1
204554478 457493106 1
292281241 -451960647 2
-118009426 -385777341 2
-912961149 -2008116...

output:

223820604

result:

ok single line: '223820604'

Test #19:

score: 45
Accepted
time: 418ms
memory: 6124kb

input:

30000 2
-15001 225030001 1
-15000 225000000 1
-14999 224970001 1
-14998 224940004 1
-14997 224910009 1
-14996 224880016 1
-14995 224850025 1
-14994 224820036 1
-14993 224790049 1
-14992 224760064 1
-14991 224730081 1
-14990 224700100 1
-14989 224670121 1
-14988 224640144 1
-14987 224610169 1
-14986 ...

output:

112500000

result:

ok single line: '112500000'

Test #20:

score: 45
Accepted
time: 419ms
memory: 6088kb

input:

30000 2
-15001 225030001 1
-15000 225000000 1
-14999 224970001 1
-14998 224940004 1
-14997 224910009 1
-14996 224880016 1
-14995 224850025 1
-14994 224820036 1
-14993 224790049 1
-14992 224760064 1
-14991 224730081 1
-14990 224700100 1
-14989 224670121 1
-14988 224640144 1
-14987 224610169 1
-14986 ...

output:

225000000

result:

ok single line: '225000000'

Subtask #3:

score: 40
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #21:

score: 40
Accepted
time: 1039ms
memory: 8128kb

input:

30000 2
-1000000000 481765933 1
85377743 270216262 2
191391529 -187330300 1
-446524492 -554650248 2
344887256 -269582744 2
812158119 -852300289 1
-119731649 889772843 1
-313921295 -894245893 2
-817453607 949118330 1
-779862634 979932169 1
89957932 873226917 2
-284330153 486937972 2
196032868 -222793...

output:

114434334

result:

ok single line: '114434334'

Test #22:

score: 40
Accepted
time: 1916ms
memory: 6212kb

input:

30000 10
-1000000000 481765933 1
85377743 270216262 10
191391529 -187330300 4
-446524492 -554650248 6
344887256 -269582744 10
812158119 -852300289 7
-119731649 889772843 8
-313921295 -894245893 7
-817453607 949118330 7
-779862634 979932169 5
89957932 873226917 6
-284330153 486937972 10
196032868 -22...

output:

4594791
4606027
4642995
4608419
4665545
4583826
4552677
4454890
4447850
4498307
4445275
4616223
4588501
4648237
4617711
4620077
4624322
4596488
4446626
4661787
4643833
4609570
4497547
4506503
4524978
4355936
4478530
4572607
4644471
4581219
4600325
4469008
4600315
4561146
4684706
4473608
4566827
4643...

result:

ok 50 lines

Test #23:

score: 40
Accepted
time: 1428ms
memory: 6592kb

input:

30000 100
939784796 396935811 16
-421865754 -869705880 50
-258329760 -951761039 23
781173223 -79297285 74
435263459 456517962 70
-482943583 151203185 93
499948029 -963908424 92
458479138 -862328430 52
-860458726 -542868912 8
161497742 -51937422 20
975554199 628086945 57
-800176960 -558949521 2
14241...

output:

29193
24859
28286
22579
23028
23908
19816
22660
27634
30042
26549
25005
23970
24328
31891
28326
27803
30024
29137
29083
26978
26775
23567
28776
25898
31683
25823
24303
26662
26729
29242
21621
29920
30727
24821
22853
26502
30260
24263
24194
25563
27476
25332
24915
30458
24862
29426
27686
23824
27657
...

result:

ok 5000 lines

Test #24:

score: 40
Accepted
time: 580ms
memory: 12636kb

input:

30000 1000
939784796 396935811 949
-421865754 -869705880 760
-258329760 -951761039 842
781173223 -79297285 741
435263459 456517962 41
-482943583 151203185 502
499948029 -963908424 337
458479138 -862328430 55
-860458726 -542868912 857
161497742 -51937422 583
975554199 628086945 297
-800176960 -558949...

output:

290
245
142
407
131
276
222
396
187
199
196
242
232
275
348
357
325
492
188
231
160
221
412
278
487
221
203
315
228
251
287
312
238
365
234
271
192
398
371
178
323
205
249
241
385
235
210
141
244
382
337
355
181
277
373
250
218
300
177
314
381
283
356
266
372
237
221
161
451
273
210
239
320
222
306
...

result:

ok 100000 lines

Test #25:

score: 40
Accepted
time: 73ms
memory: 12732kb

input:

30000 10000
291730505 140550897 235
140418385 -675533154 8570
932475537 -969615142 3361
671105296 -336626937 9
-452990164 347543569 3211
345539362 -697541269 8310
-335566777 274814346 8581
42012189 -834758196 2910
994682317 -630719833 1857
427414129 -641390965 3797
-624922955 -73766579 537
-17589644...

output:

6
17
0
4
1
0
5
0
0
7
21
3
3
7
13
8
4
3
4
4
2
1
4
0
2
12
14
5
0
0
6
11
9
1
0
3
6
9
7
8
2
6
9
2
9
4
2
8
5
6
7
4
14
4
2
1
5
8
7
7
3
5
8
6
4
5
11
1
5
8
4
0
12
5
3
1
0
8
0
2
2
0
6
15
1
6
9
0
2
3
5
5
4
6
4
2
11
1
2
3
6
13
6
3
2
7
6
6
1
7
11
10
3
4
2
4
6
13
10
2
7
15
2
10
2
0
3
7
12
4
1
4
3
6
1
4
8
7
6
4
1...

result:

ok 100000 lines

Test #26:

score: 40
Accepted
time: 69ms
memory: 13488kb

input:

30000 30000
291730505 140550897 2520
140418385 -675533154 14028
932475537 -969615142 21880
671105296 -336626937 5276
-452990164 347543569 15029
345539362 -697541269 14118
-335566777 274814346 2826
42012189 -834758196 414
994682317 -630719833 21858
427414129 -641390965 4660
-624922955 -73766579 22129...

output:

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

result:

ok 100000 lines

Test #27:

score: 40
Accepted
time: 9ms
memory: 8452kb

input:

30000 30000
932757444 812851329 1
-691190593 -710348784 2
-213720716 -518031063 3
-450036883 -662886783 4
-800040425 30935169 5
-965538429 -822325860 6
-762104969 -409750301 7
-707936479 -275350962 8
-331603419 839177873 9
-726837318 -248358273 10
985900155 -274629422 11
68226527 -609819209 12
30274...

output:

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

result:

ok 15000 lines

Test #28:

score: 40
Accepted
time: 13ms
memory: 8536kb

input:

30000 30000
932757444 812851329 1
-691190593 -710348784 2
-213720716 -518031063 3
-450036883 -662886783 4
-800040425 30935169 5
-965538429 -822325860 6
-762104969 -409750301 7
-707936479 -275350962 8
-331603419 839177873 9
-726837318 -248358273 10
985900155 -274629422 11
68226527 -609819209 12
30274...

output:

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

result:

ok 15000 lines

Test #29:

score: 40
Accepted
time: 2410ms
memory: 13012kb

input:

30000 30000
-999778383 -502347403 4078
-758123195 977677611 4985
973914227 -336945718 1
-521681790 -795213142 1
-972570538 530321112 4581
-277441779 -609880301 16789
-101013909 779443287 9538
-80301681 -88972766 13520
-253919024 -150286243 1
-894041513 29338063 1
-892554830 -918363183 11202
-4669289...

output:

0
0
0
0
0
12092
0
0
0
0
0
0
4897
0
0
0
1
0
0
0
0
0
0
0
0
1
0
4567
0
11436
0
5623
0
0
0
5948
15630
7473
0
0
0
0
5310
0
9946
0
12207
9861
0
7001
6653
0
0
20922
11614
0
3619
0
0
0
0
0
0
2
0
0
9507
0
0
0
4689
0
11024
0
0
13908
0
0
0
10301
0
0
0
9678
0
7183
0
5311
0
0
0
0
0
0
0
0
0
4640
0
0
0
0
0
0
14873...

result:

ok 100000 lines

Test #30:

score: 40
Accepted
time: 95ms
memory: 12860kb

input:

30000 30000
-999778383 -502347403 1
-758123195 977677611 1
973914227 -336945718 9468
-521681790 -795213142 1
-972570538 530321112 1
-277441779 -609880301 12651
-101013909 779443287 1
-80301681 -88972766 1
-253919024 -150286243 1
-894041513 29338063 1
-892554830 -918363183 1
-466928952 -686285019 157...

output:

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

result:

ok 100000 lines

Test #31:

score: 40
Accepted
time: 71ms
memory: 13084kb

input:

30000 30000
-999778383 -502347403 4614
-758123195 977677611 1
973914227 -336945718 3323
-521681790 -795213142 1
-972570538 530321112 8213
-277441779 -609880301 1
-101013909 779443287 1404
-80301681 -88972766 1
-253919024 -150286243 16642
-894041513 29338063 4710
-892554830 -918363183 14642
-46692895...

output:

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

result:

ok 100000 lines

Test #32:

score: 40
Accepted
time: 78ms
memory: 13440kb

input:

30000 30000
-999778383 -502347403 81
-758123195 977677611 9
973914227 -336945718 20826
-521681790 -795213142 7382
-972570538 530321112 53
-277441779 -609880301 22
-101013909 779443287 136
-80301681 -88972766 27924
-253919024 -150286243 53
-894041513 29338063 21287
-892554830 -918363183 138
-46692895...

output:

0
0
0
0
27
0
0
0
0
0
0
48
23
0
32
0
0
32
39
47
33
0
0
0
1
50
0
0
0
0
0
0
0
0
0
48
0
0
0
79
0
0
48
0
0
0
45
1
32
1
87
0
0
0
0
0
0
0
0
0
33
0
0
0
0
0
0
0
1
0
0
0
0
0
0
48
0
0
0
21
0
0
0
0
79
33
0
0
0
101
0
0
0
0
0
0
46
0
0
43
0
0
43
0
0
0
0
0
0
0
0
0
0
71
0
0
88
59
0
15
40
0
45
0
0
32
0
0
0
0
1
32
0
0...

result:

ok 100000 lines

Test #33:

score: 40
Accepted
time: 492ms
memory: 13440kb

input:

30000 30000
-999778383 -502347403 5149
-758123195 977677611 17
973914227 -336945718 14681
-521681790 -795213142 8245
-972570538 530321112 94
-277441779 -609880301 131
-101013909 779443287 23269
-80301681 -88972766 608
-253919024 -150286243 16
-894041513 29338063 17
-892554830 -918363183 24434
-46692...

output:

0
0
77
0
1718
0
0
0
0
0
1
12
0
17
0
0
0
0
0
1010
0
1603
0
1036
0
11
0
0
0
0
0
0
0
0
0
0
12
0
1162
32
948
1306
0
1258
0
0
0
0
0
1084
1459
836
0
1395
4
12
2
0
989
1021
1204
0
566
3
0
1234
0
4
0
17
24
0
0
0
0
1
1135
0
0
0
0
19
0
1279
0
1378
0
0
0
0
0
22
0
0
0
0
0
0
657
991
761
1371
0
0
0
0
0
19
0
2
134...

result:

ok 100000 lines

Test #34:

score: 40
Accepted
time: 59ms
memory: 13428kb

input:

30000 30000
-108721716 138363973 20416
-597960130 111468907 27673
633468362 -162830470 184
413230101 999644008 15460
654707361 665949201 10486
143190789 -459072914 13393
-341754313 -822841726 153
402247130 -973163871 91
292817790 -381990371 27580
588567171 -464382773 194
-299753200 858404100 29330
-...

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

result:

ok 100000 lines

Test #35:

score: 40
Accepted
time: 66ms
memory: 15280kb

input:

30000 30000
-108721716 138363973 5684
-597960130 111468907 3481
633468362 -162830470 26040
413230101 999644008 16322
654707361 665949201 9126
143190789 -459072914 2902
-341754313 -822841726 21486
402247130 -973163871 12327
292817790 -381990371 26991
588567171 -464382773 23723
-299753200 858404100 42...

output:

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

result:

ok 100000 lines

Test #36:

score: 40
Accepted
time: 73ms
memory: 13560kb

input:

30000 30000
-108721716 138363973 20951
-597960130 111468907 9289
633468362 -162830470 13543
413230101 999644008 23537
654707361 665949201 7766
143190789 -459072914 22412
-341754313 -822841726 17418
402247130 -973163871 15011
292817790 -381990371 2754
588567171 -464382773 10300
-299753200 858404100 9...

output:

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

result:

ok 100000 lines

Test #37:

score: 40
Accepted
time: 61ms
memory: 13424kb

input:

30000 30000
-108721716 138363973 6219
-597960130 111468907 15097
633468362 -162830470 1046
413230101 999644008 24399
654707361 665949201 12758
143190789 -459072914 18274
-341754313 -822841726 13351
402247130 -973163871 17695
292817790 -381990371 2165
588567171 -464382773 26877
-299753200 858404100 1...

output:

2
0
0
0
0
4
0
1
0
0
0
0
0
2
0
0
0
3
1
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
2
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
1
0
0
0
0
6
2
0
0
0
1
0
0
2
0
0
1
0
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
1
1
1
0
0
1
0
0
0
0
0
0
0
2
0
0
2
0
0
0
0
0
0
0
3
0
0
0
0
0
...

result:

ok 100000 lines

Test #38:

score: 40
Accepted
time: 696ms
memory: 13336kb

input:

30000 30000
-108721716 138363973 21487
-597960130 111468907 5
633468362 -162830470 24901
413230101 999644008 1614
654707361 665949201 99
143190789 -459072914 83
-341754313 -822841726 9283
402247130 -973163871 79
292817790 -381990371 29
588567171 -464382773 6
-299753200 858404100 61
-815071706 -93054...

output:

0
0
0
6908
19
7102
0
0
0
92
41
18
38
0
9
0
0
43
36
7990
5832
0
4078
5996
5241
5410
0
0
5281
8000
0
5399
7154
0
6172
0
6304
0
5952
5731
0
0
37
0
38
8687
0
0
0
0
72
7
0
5242
0
36
6280
1
0
0
6503
6536
0
0
4840
0
15
96
0
0
0
209
5161
0
10
135
0
122
4491
17
5459
0
0
8479
0
6450
0
0
0
0
0
0
0
0
0
2
0
0
53...

result:

ok 100000 lines

Test #39:

score: 40
Accepted
time: 621ms
memory: 13260kb

input:

30000 30000
206155238 127299636 4
149643099 -935937593 13
-298031381 -106328572 12405
829613423 911952256 76
143488145 147122957 10039
-883308656 -859830495 3645
573003428 616918737 116
411803281 -426816963 113
-484259047 -44022428 140
921087101 -994589931 6383
803623464 450665166 17457
-736723125 -...

output:

101
0
46
0
0
0
0
0
5235
0
6767
0
5888
67
0
5588
164
6457
0
0
6515
0
6148
0
0
0
0
0
6752
5310
40
0
0
2
0
0
1
0
0
43
38
0
0
0
0
0
0
0
7131
6231
0
0
0
61
0
5060
0
0
6821
5747
5265
5645
6564
53
6068
0
6430
0
6189
0
0
0
0
0
0
0
0
0
80
58
0
5473
6136
2
4140
4831
0
35
0
5470
79
0
0
0
48
0
0
0
0
5783
0
62
0...

result:

ok 100000 lines

Test #40:

score: 40
Accepted
time: 541ms
memory: 13604kb

input:

30000 30000
206155238 127299636 22
149643099 -935937593 2521
-298031381 -106328572 6260
829613423 911952256 91
143488145 147122957 31
-883308656 -859830495 23154
573003428 616918737 1148
411803281 -426816963 2099
-484259047 -44022428 13103
921087101 -994589931 29312
803623464 450665166 153
-73672312...

output:

38
0
4214
33
0
77
3134
0
3484
2098
0
2764
0
0
0
0
34
0
2219
39
0
0
0
0
2413
1
0
2934
2810
0
0
0
0
0
0
54
2994
2705
0
0
49
26
24
0
51
4113
30
0
1
2349
0
0
22
0
0
0
0
2506
0
0
0
0
0
0
0
0
93
104
22
3771
3279
41
0
127
0
0
3044
0
0
31
0
4494
2209
0
32
2538
3
0
31
0
0
0
3045
0
41
0
26
2246
2631
0
0
0
0
2...

result:

ok 100000 lines

Test #41:

score: 40
Accepted
time: 2308ms
memory: 15104kb

input:

30000 30000
206155238 127299636 1
149643099 -935937593 7785
-298031381 -106328572 2
829613423 911952256 2
143488145 147122957 12311
-883308656 -859830495 1
573003428 616918737 23013
411803281 -426816963 2
-484259047 -44022428 2
921087101 -994589931 8818
803623464 450665166 2144
-736723125 -597124742...

output:

0
6596
0
1317
14602713
14812692
0
0
1636
0
5117
0
0
2207
0
0
1514
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
767
1701
0
1109
0
3365
0
2066
0
0
1298
0
1114
0
0
0
1291
1947
0
5761
2298
0
0
1356
4764
1
0
0
0
0
3787
0
0
891
0
1
1175
0
0
1
0
1683
748
0
0
0
0
0
0
0
0
0
0
0
0
0
6634
0
1943
0
0
1769
0
0
0
1636
0
209...

result:

ok 100000 lines

Test #42:

score: 40
Accepted
time: 1608ms
memory: 13080kb

input:

30000 30000
206155238 127299636 7824
149643099 -935937593 4
-298031381 -106328572 1
829613423 911952256 1
143488145 147122957 4
-883308656 -859830495 5
573003428 616918737 1
411803281 -426816963 5
-484259047 -44022428 24041
921087101 -994589931 25395
803623464 450665166 5
-736723125 -597124742 1
-56...

output:

1740663
1070
1803297
0
1875264
0
0
644
0
0
3
0
0
263
1766069
0
1778745
0
0
0
408
0
0
0
0
0
0
1744500
651
0
0
1829539
0
0
0
475
1842005
1
285
431
1789467
0
674
679
298
0
0
3111
0
484
1771601
1755
691
0
0
0
0
305
0
0
0
0
1820646
1
0
1488
0
0
0
0
0
0
0
1700911
0
0
0
1826009
0
0
0
0
0
0
1748366
0
0
0
0
...

result:

ok 100000 lines

Test #43:

score: 40
Accepted
time: 1241ms
memory: 13236kb

input:

30000 30000
206155238 127299636 2
149643099 -935937593 2
-298031381 -106328572 5
829613423 911952256 5
143488145 147122957 15944
-883308656 -859830495 23896
573003428 616918737 21230
411803281 -426816963 12834
-484259047 -44022428 2
921087101 -994589931 5
803623464 450665166 11936
-736723125 -597124...

output:

0
0
330
0
0
0
1055
0
0
0
979638
0
0
0
1256
0
0
0
988096
0
0
777
0
0
0
903990
0
0
986345
963797
1356
0
962124
0
0
900755
0
830
0
328
0
0
1100
0
1008
0
0
915932
0
0
0
897
764
0
338
658
986070
0
170
0
1339
977176
0
0
944365
0
0
0
0
0
0
1025779
2419
985
1493
454
958
0
0
0
0
0
385
0
0
0
1032614
381
456
9...

result:

ok 100000 lines

Test #44:

score: 40
Accepted
time: 1470ms
memory: 7456kb

input:

30000 15000
-1000000000 481765933 8360
85377743 270216262 1
191391529 -187330300 1480
-446524492 -554650248 1
344887256 -269582744 1
812158119 -852300289 13406
-119731649 889772843 1
-313921295 -894245893 6870
-817453607 949118330 1
-779862634 979932169 1
89957932 873226917 1
-284330153 486937972 25...

output:

0
34070
7066
0
0
4038
0
0
4116
12683
3248
7810
0
11830
6402
4950
0
6842
0
1212
2374
10879
0
28390
9413
19048
5829
11220
0
0
0
2484
0
4142
0
14145
4378
0
0
0
3767
0
40238
2660
4809
2797
13663
3328
7038
6596
0
15670
7140
5060
18085
4266
11817
0
0
2011
12495
0
4842
10441
0
1963
2299
2236
2424
0
0
7241
...

result:

ok 14999 lines

Test #45:

score: 40
Accepted
time: 736ms
memory: 9648kb

input:

30000 15000
-1000000000 481765933 8627
85377743 270216262 1018
191391529 -187330300 3983
-446524492 -554650248 2
344887256 -269582744 2
812158119 -852300289 9268
-119731649 889772843 13096
-313921295 -894245893 2
-817453607 949118330 4979
-779862634 979932169 12831
89957932 873226917 2
-284330153 48...

output:

7366
589
0
1049
0
3921
6710
0
780
1010
1598
641
0
5320
0
2162
4184
2666
3624
438
7060
0
3696
0
2060
1786
1065
1933
955
0
1325
1020
0
0
0
5380
1912
2400
0
1908
222
4927
2629
0
1053
3920
0
0
0
3122
8401
5724
0
0
0
0
931
1081
2465
7244
0
0
0
11938
0
2249
921
0
0
1205
1019
464
1200
2930
0
0
9083
1395
0
...

result:

ok 14998 lines

Test #46:

score: 40
Accepted
time: 466ms
memory: 9552kb

input:

30000 15000
-1000000000 481765933 3
85377743 270216262 6826
191391529 -187330300 12838
-446524492 -554650248 4785
344887256 -269582744 3216
812158119 -852300289 1
-119731649 889772843 1
-313921295 -894245893 1
-817453607 949118330 1
-779862634 979932169 14408
89957932 873226917 5272
-284330153 48693...

output:

198
0
112
4896
77
0
0
1669
162
129
0
116
0
253
675
476
463
0
0
0
1313
156
140
282
85
426
173
0
344
1185
178
0
195
440
337
0
0
181
0
0
0
0
115
0
1218
657
0
0
90
0
189
538
658
0
455
0
262
432
249
324
0
559
236
239
141
127
834
0
0
323
0
175
1593
433
3540
331
564
271
0
0
459
126
0
450
730
126
578
123
43...

result:

ok 14997 lines

Test #47:

score: 40
Accepted
time: 1072ms
memory: 7544kb

input:

30000 15000
-1000000000 481765933 9162
85377743 270216262 12634
191391529 -187330300 341
-446524492 -554650248 11999
344887256 -269582744 1
812158119 -852300289 1
-119731649 889772843 4961
-313921295 -894245893 14922
-817453607 949118330 1
-779862634 979932169 1
89957932 873226917 1
-284330153 48693...

output:

30
0
0
0
434
3784
0
1185
1544
2581
1520
865
706
591
933
1968
0
518
0
14562
0
0
517
0
2316
581
0
639
1145
1347
654
1695
0
1053
1642
0
451
1940
864
0
0
1463
758
0
1087
0
926
1333
5777
715
37
0
216
981
894
888
7408
0
0
867
1181
355
580
2087
1243
0
0
1514
0
157
702
0
304
2553
667
365
0
0
1335
0
1727
188...

result:

ok 14999 lines

Test #48:

score: 40
Accepted
time: 695ms
memory: 7512kb

input:

30000 15000
-1000000000 481765933 2
85377743 270216262 2
191391529 -187330300 1
-446524492 -554650248 12862
344887256 -269582744 6849
812158119 -852300289 2
-119731649 889772843 1
-313921295 -894245893 2605
-817453607 949118330 9564
-779862634 979932169 2
89957932 873226917 63
-284330153 486937972 3...

output:

0
2094
5676
7634
0
0
3138
0
3424
7091
4387
2200
0
2868
0
0
6189
0
334
2434
0
1192
2394
0
0
4036
3509
0
2076
0
0
4894
5468
0
1567
10171
0
0
3974
5134
2294
9217
1843
38
3182
2231
0
3947
8800
0
1446
381
2264
0
0
986
854
4755
13465
5916
2721
0
5296
5793
0
0
0
4538
6264
3830
0
8568
2310
2574
0
0
2031
0
1...

result:

ok 14998 lines

Test #49:

score: 40
Accepted
time: 423ms
memory: 7600kb

input:

30000 15000
-1000000000 481765933 9697
85377743 270216262 1
191391529 -187330300 3
-446524492 -554650248 5077
344887256 -269582744 5489
812158119 -852300289 10010
-119731649 889772843 11826
-313921295 -894245893 1
-817453607 949118330 1
-779862634 979932169 10491
89957932 873226917 3
-284330153 4869...

output:

1586
0
0
1517
0
0
0
3952
3332
5035
1438
3460
0
2833
0
0
3659
1612
0
0
1932
0
0
0
0
2058
0
0
0
5262
3316
3324
0
0
3423
0
1924
0
0
3712
1971
4867
1250
2376
0
0
1603
0
0
4458
5452
1728
4493
2679
3547
5181
0
1560
1712
855
3576
3446
3390
3870
2964
1404
2358
2366
1748
6115
0
0
0
1476
299
4096
1468
4539
19...

result:

ok 14997 lines

Extra Test:

score: 0
Extra Test Passed