QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#311233#953. Chess Rushqiuzx100 ✓130ms27992kbC++174.1kb2024-01-22 08:35:432024-01-22 08:35:56

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Accepted

Test #1:

score: 0
Accepted
time: 3ms
memory: 14656kb

input:

8 8 5
P 1 2
R 4 8
Q 2 3
B 3 6
K 5 5

output:

0 0
2 2
2 5
2 2
7 393

result:

ok 5 lines

Test #2:

score: 0
Accepted
time: 52ms
memory: 26556kb

input:

1000000 800 1000
B 109 725
B 102 776
B 177 506
R 79 438
R 151 438
B 767 798
B 775 127
K 777 785
B 88 389
K 641 238
P 4 338
P 733 512
K 703 768
Q 525 639
P 290 680
R 748 546
K 319 607
K 595 380
R 338 525
P 137 242
K 638 26
R 222 698
P 120 120
B 659 658
K 101 254
K 761 393
P 531 351
P 306 169
K 41 637...

output:

0 0
0 0
1253 358898395
2 2
2 2
1252 283431912
0 0
999999 463989228
1253 964139672
999999 366396973
0 0
0 0
999999 503447053
2 4
0 0
2 2
999999 483704042
999999 169784669
2 2
0 0
999999 577740409
2 2
999999 1
1252 170118
999999 637452311
999999 981258762
0 0
0 0
999999 646624036
0 0
2 4
2 4
999999 64...

result:

ok 1000 lines

Subtask #2:

score: 8
Accepted

Test #3:

score: 8
Accepted
time: 1ms
memory: 15560kb

input:

8 8 192
P 1 1
P 1 2
P 1 3
P 1 4
P 1 5
P 1 6
P 1 7
P 1 8
P 2 1
P 2 2
P 2 3
P 2 4
P 2 5
P 2 6
P 2 7
P 2 8
P 3 1
P 3 2
P 3 3
P 3 4
P 3 5
P 3 6
P 3 7
P 3 8
P 4 1
P 4 2
P 4 3
P 4 4
P 4 5
P 4 6
P 4 7
P 4 8
P 5 1
P 5 2
P 5 3
P 5 4
P 5 5
P 5 6
P 5 7
P 5 8
P 6 1
P 6 2
P 6 3
P 6 4
P 6 5
P 6 6
P 6 7
P 6 8
P 7 ...

output:

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

result:

ok 192 lines

Test #4:

score: 0
Accepted
time: 3ms
memory: 14848kb

input:

999999 15 675
P 1 1
P 1 2
P 1 3
P 1 4
P 1 5
P 1 6
P 1 7
P 1 8
P 1 9
P 1 10
P 1 11
P 1 12
P 1 13
P 1 14
P 1 15
P 2 1
P 2 2
P 2 3
P 2 4
P 2 5
P 2 6
P 2 7
P 2 8
P 2 9
P 2 10
P 2 11
P 2 12
P 2 13
P 2 14
P 2 15
P 3 1
P 3 2
P 3 3
P 3 4
P 3 5
P 3 6
P 3 7
P 3 8
P 3 9
P 3 10
P 3 11
P 3 12
P 3 13
P 3 14
P 3 1...

output:

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

result:

ok 675 lines

Test #5:

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

input:

5 2 12
P 1 1
P 1 2
P 2 1
P 2 2
R 1 1
R 1 2
R 2 1
R 2 2
Q 1 1
Q 1 2
Q 2 1
Q 2 2

output:

4 1
0 0
0 0
4 1
1 1
2 2
2 2
1 1
1 1
2 4
2 4
1 1

result:

ok 12 lines

Test #6:

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

input:

401 401 1000
Q 55 364
Q 51 389
Q 89 254
P 40 220
P 76 220
Q 384 400
Q 389 64
Q 390 394
Q 45 195
Q 321 120
Q 401 1
P 368 368
Q 353 385
R 263 320
P 145 341
P 375 274
Q 160 304
Q 298 191
R 170 263
P 69 122
Q 320 13
P 112 350
P 60 39
Q 331 330
Q 51 128
Q 382 197
P 267 176
P 154 85
Q 21 319
P 75 164
R 18...

output:

2 4
2 5
2 4
0 0
0 0
2 5
2 4
2 5
2 5
2 4
1 1
400 1
2 5
2 2
0 0
0 0
2 5
2 4
2 2
0 0
2 4
0 0
0 0
2 4
2 4
2 4
0 0
0 0
2 5
0 0
2 2
2 2
2 4
2 4
2 4
2 4
0 0
2 5
2 2
2 5
2 4
2 5
2 5
2 2
2 2
2 4
0 0
2 5
2 4
0 0
2 2
2 5
2 2
2 5
2 5
1 1
2 5
2 5
2 4
1 1
0 0
2 2
2 5
2 4
2 2
2 2
2 2
2 5
2 5
2 2
2 2
2 2
2 4
2 5
0 ...

result:

ok 1000 lines

Subtask #3:

score: 15
Accepted

Test #7:

score: 15
Accepted
time: 3ms
memory: 14232kb

input:

2 2 4
B 1 1
B 1 2
B 2 1
B 2 2

output:

0 0
1 1
1 1
0 0

result:

ok 4 lines

Test #8:

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

input:

100 11 121
B 1 1
B 1 2
B 1 3
B 1 4
B 1 5
B 1 6
B 1 7
B 1 8
B 1 9
B 1 10
B 1 11
B 2 1
B 2 2
B 2 3
B 2 4
B 2 5
B 2 6
B 2 7
B 2 8
B 2 9
B 2 10
B 2 11
B 3 1
B 3 2
B 3 3
B 3 4
B 3 5
B 3 6
B 3 7
B 3 8
B 3 9
B 3 10
B 3 11
B 4 1
B 4 2
B 4 3
B 4 4
B 4 5
B 4 6
B 4 7
B 4 8
B 4 9
B 4 10
B 4 11
B 5 1
B 5 2
B 5 3...

output:

0 0
10 1
0 0
11 55
0 0
11 220
0 0
11 715
0 0
11 2002
0 0
10 1
0 0
11 11
0 0
11 55
0 0
11 220
0 0
11 715
0 0
11 2002
0 0
11 11
0 0
11 11
0 0
11 55
0 0
11 220
0 0
11 715
0 0
11 55
0 0
11 11
0 0
11 11
0 0
11 55
0 0
11 220
0 0
11 715
0 0
11 55
0 0
11 11
0 0
11 11
0 0
11 55
0 0
11 220
0 0
11 220
0 0
11 5...

result:

ok 121 lines

Test #9:

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

input:

99 7 49
B 1 1
B 1 2
B 1 3
B 1 4
B 1 5
B 1 6
B 1 7
B 2 1
B 2 2
B 2 3
B 2 4
B 2 5
B 2 6
B 2 7
B 3 1
B 3 2
B 3 3
B 3 4
B 3 5
B 3 6
B 3 7
B 4 1
B 4 2
B 4 3
B 4 4
B 4 5
B 4 6
B 4 7
B 5 1
B 5 2
B 5 3
B 5 4
B 5 5
B 5 6
B 5 7
B 6 1
B 6 2
B 6 3
B 6 4
B 6 5
B 6 6
B 6 7
B 7 1
B 7 2
B 7 3
B 7 4
B 7 5
B 7 6
B 7 7

output:

18 20349
0 0
17 1
0 0
17 16
0 0
17 136
0 0
18 4846
0 0
17 1
0 0
17 16
0 0
17 1
0 0
18 986
0 0
17 1
0 0
17 16
0 0
17 1
0 0
18 306
0 0
17 1
0 0
17 16
0 0
17 1
0 0
18 986
0 0
17 1
0 0
17 16
0 0
17 1
0 0
18 4846
0 0
17 136
0 0
17 16
0 0
17 1
0 0
18 20349

result:

ok 49 lines

Test #10:

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

input:

98 15 225
B 1 1
B 1 2
B 1 3
B 1 4
B 1 5
B 1 6
B 1 7
B 1 8
B 1 9
B 1 10
B 1 11
B 1 12
B 1 13
B 1 14
B 1 15
B 2 1
B 2 2
B 2 3
B 2 4
B 2 5
B 2 6
B 2 7
B 2 8
B 2 9
B 2 10
B 2 11
B 2 12
B 2 13
B 2 14
B 2 15
B 3 1
B 3 2
B 3 3
B 3 4
B 3 5
B 3 6
B 3 7
B 3 8
B 3 9
B 3 10
B 3 11
B 3 12
B 3 13
B 3 14
B 3 15
B ...

output:

0 0
8 1716
0 0
8 924
0 0
8 462
0 0
8 210
0 0
8 84
0 0
8 28
0 0
7 1
0 0
8 1716
0 0
8 924
0 0
8 462
0 0
8 210
0 0
8 84
0 0
8 28
0 0
8 8
0 0
7 1
0 0
8 924
0 0
8 462
0 0
8 210
0 0
8 84
0 0
8 28
0 0
8 8
0 0
8 8
0 0
8 924
0 0
8 462
0 0
8 210
0 0
8 84
0 0
8 28
0 0
8 8
0 0
8 8
0 0
8 28
0 0
8 462
0 0
8 210
0...

result:

ok 225 lines

Subtask #4:

score: 22
Accepted

Dependency #3:

100%
Accepted

Test #11:

score: 22
Accepted
time: 11ms
memory: 27716kb

input:

1000 1000 1000
B 815 136
B 906 836
B 127 969
B 914 222
B 633 309
B 1 1000
B 279 189
B 547 993
B 958 997
B 965 968
B 158 726
B 971 982
B 958 110
B 486 799
B 801 298
B 142 5
B 422 113
B 916 640
B 793 879
B 960 504
B 656 798
B 36 362
B 850 212
B 934 682
B 679 399
B 758 741
B 744 475
B 393 423
B 656 174...

output:

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

result:

ok 1000 lines

Test #12:

score: 0
Accepted
time: 16ms
memory: 21732kb

input:

1000000 500 1000
B 408 68
B 453 418
B 64 485
B 457 111
B 317 155
B 49 274
B 140 95
B 274 497
B 479 499
B 483 484
B 79 363
B 486 491
B 479 55
B 243 400
B 401 149
B 71 3
B 211 57
B 458 320
B 397 440
B 480 252
B 328 399
B 18 181
B 425 106
B 467 341
B 340 200
B 379 371
B 372 238
B 197 212
B 328 87
B 86 ...

output:

0 0
2005 364508886
2005 983341468
0 0
0 0
2005 771745920
2005 429401042
2005 129453074
0 0
2006 135436206
0 0
2005 2004
0 0
2005 425055505
0 0
0 0
0 0
0 0
2005 780146953
0 0
2005 510889455
2005 143898896
2005 853038482
0 0
0 0
0 0
0 0
2005 113347501
2005 66250506
2005 274961204
2005 429401042
2005 7...

result:

ok 1000 lines

Test #13:

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

input:

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

output:

0 0
333334 425522228
0 0
333334 344079822
0 0
333334 272220031
0 0
333334 28373966
0 0
333334 281224817
0 0
333334 993357162
0 0
333334 521637166
0 0
333334 500018263
0 0
333334 555610726
0 0
333334 333333
0 0
333334 1
0 0
333335 846234676
0 0
333335 104551217
0 0
333335 78325063
0 0
333335 53144675...

result:

ok 961 lines

Test #14:

score: 0
Accepted
time: 103ms
memory: 27728kb

input:

999999999 1000 1000
B 815 136
B 906 836
B 127 969
B 914 222
B 633 309
B 98 548
B 279 189
B 547 993
B 958 997
B 965 968
B 158 726
B 971 982
B 958 110
B 486 799
B 801 298
B 142 5
B 422 113
B 916 640
B 793 879
B 960 504
B 656 798
B 36 362
B 850 212
B 934 682
B 679 399
B 758 741
B 744 475
B 393 423
B 65...

output:

0 0
1001002 890731696
1001002 938959839
1001002 101521312
1001002 288080766
1001002 749726168
1001002 231557562
1001002 318085950
0 0
0 0
1001002 66130636
0 0
1001002 629568774
0 0
0 0
0 0
0 0
1001002 261102584
1001002 171145291
1001002 653267260
1001002 334826867
1001002 127437336
1001002 928233913...

result:

ok 1000 lines

Test #15:

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

input:

988788688 5 1000
B 5 1
B 5 5
B 1 5
B 5 2
B 4 2
B 1 3
B 2 1
B 3 5
B 5 5
B 5 5
B 1 4
B 5 5
B 5 1
B 3 4
B 5 2
B 1 1
B 3 1
B 5 4
B 4 5
B 5 3
B 4 4
B 1 2
B 5 2
B 5 4
B 4 2
B 4 4
B 4 3
B 2 3
B 4 1
B 1 2
B 4 4
B 1 2
B 2 5
B 1 1
B 1 5
B 5 5
B 4 1
B 2 4
B 5 3
B 1 4
B 3 1
B 2 2
B 4 1
B 4 1
B 1 3
B 3 3
B 3 3
B...

output:

0 0
0 0
0 0
247197173 832124838
0 0
0 0
247197172 1
0 0
0 0
0 0
247197173 832124838
0 0
0 0
247197173 247197173
247197173 832124838
0 0
0 0
247197172 1
247197172 1
0 0
0 0
247197172 1
247197173 832124838
247197172 1
0 0
0 0
247197173 247197173
247197173 247197173
247197173 832124838
247197172 1
0 0
...

result:

ok 1000 lines

Test #16:

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

input:

999999111 87 1000
B 71 12
B 79 73
B 12 85
B 80 20
B 56 27
B 9 48
B 25 17
B 48 87
B 84 87
B 84 85
B 14 64
B 85 86
B 84 10
B 43 70
B 70 26
B 13 1
B 37 10
B 80 56
B 69 77
B 84 44
B 58 70
B 4 32
B 74 19
B 82 60
B 60 35
B 66 65
B 65 42
B 35 37
B 58 16
B 15 27
B 62 70
B 3 28
B 25 76
B 5 13
B 9 87
B 72 72
...

output:

0 0
11627898 276802888
0 0
11627897 687292308
0 0
0 0
11627898 304319275
0 0
0 0
0 0
11627898 46520668
0 0
11627897 158418222
0 0
11627898 307787756
11627898 494333349
0 0
11627898 125712405
11627898 468104384
11627898 973478452
11627898 973478452
11627898 370387441
0 0
11627898 59073633
0 0
0 0
0 0...

result:

ok 1000 lines

Subtask #5:

score: 5
Accepted

Test #17:

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

input:

100 31 50
K 26 5
K 29 26
K 4 31
K 29 7
K 20 10
K 4 17
K 9 6
K 17 31
K 30 31
K 30 30
K 5 23
K 31 31
K 30 4
K 16 25
K 25 10
K 5 1
K 14 4
K 29 20
K 25 28
K 30 16
K 21 25
K 2 12
K 27 7
K 29 22
K 22 13
K 24 23
K 24 15
K 13 14
K 21 6
K 6 10
K 22 25
K 1 10
K 9 28
K 2 5
K 4 31
K 26 26
K 22 4
K 10 24
K 30 16...

output:

99 237186015
99 308355869
99 900615160
99 111497937
99 720890675
99 24578703
99 72937087
99 109926923
99 367554753
99 970965190
99 751648917
99 363338635
99 144967473
99 557421397
99 641344209
99 821457493
99 598935434
99 764581225
99 173216705
99 342569887
99 579425906
99 256365547
99 230719376
99 ...

result:

ok 50 lines

Test #18:

score: 0
Accepted
time: 2ms
memory: 15148kb

input:

100 100 50
K 82 14
K 91 84
K 13 97
K 92 23
K 64 31
K 10 55
K 28 19
K 55 100
K 96 100
K 97 97
K 16 73
K 98 99
K 96 11
K 49 80
K 81 30
K 15 1
K 43 12
K 92 64
K 80 88
K 96 51
K 66 80
K 4 37
K 85 22
K 94 69
K 68 40
K 76 75
K 75 48
K 40 43
K 66 18
K 18 31
K 71 80
K 4 32
K 28 88
K 5 15
K 10 100
K 83 83
K ...

output:

99 728523098
99 671588485
99 335177647
99 325119987
99 617135448
99 82040727
99 496522933
99 198797328
99 325430219
99 620485452
99 929095415
99 423093765
99 302727745
99 614292459
99 232929403
99 382358409
99 537508907
99 456418284
99 609553235
99 993759537
99 343161681
99 344656732
99 367907274
99...

result:

ok 50 lines

Test #19:

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

input:

99 90 50
K 74 13
K 82 76
K 12 88
K 83 20
K 57 28
K 9 50
K 26 17
K 50 90
K 87 90
K 87 88
K 15 66
K 88 89
K 87 10
K 44 72
K 73 27
K 13 1
K 38 11
K 83 58
K 72 80
K 87 46
K 60 72
K 4 33
K 77 20
K 85 62
K 62 36
K 69 67
K 67 43
K 36 38
K 59 16
K 16 28
K 64 72
K 3 29
K 25 79
K 5 14
K 9 90
K 75 74
K 63 12
K...

output:

98 353278188
98 825955607
98 666019901
98 926686765
98 942784866
98 720708980
98 718134142
98 245913719
98 142421941
98 886764382
98 871871226
98 41339358
98 732884664
98 608331108
98 100266214
98 910405667
98 112616956
98 826367085
98 820917327
98 610257623
98 752079533
98 432416795
98 847867059
98...

result:

ok 50 lines

Test #20:

score: 0
Accepted
time: 2ms
memory: 13868kb

input:

85 7 49
K 1 1
K 1 2
K 1 3
K 1 4
K 1 5
K 1 6
K 1 7
K 2 1
K 2 2
K 2 3
K 2 4
K 2 5
K 2 6
K 2 7
K 3 1
K 3 2
K 3 3
K 3 4
K 3 5
K 3 6
K 3 7
K 4 1
K 4 2
K 4 3
K 4 4
K 4 5
K 4 6
K 4 7
K 5 1
K 5 2
K 5 3
K 5 4
K 5 5
K 5 6
K 5 7
K 6 1
K 6 2
K 6 3
K 6 4
K 6 5
K 6 6
K 6 7
K 7 1
K 7 2
K 7 3
K 7 4
K 7 5
K 7 6
K 7 7

output:

84 989469614
84 159850868
84 62775729
84 352685336
84 121242142
84 446791507
84 47936019
84 159850868
84 52245336
84 512536204
84 184017871
84 799476843
84 169178161
84 446791507
84 62775729
84 512536204
84 173487478
84 959327711
84 231953890
84 799476843
84 121242142
84 352685336
84 184017871
84 95...

result:

ok 49 lines

Subtask #6:

score: 8
Accepted

Dependency #5:

100%
Accepted

Test #21:

score: 8
Accepted
time: 3ms
memory: 14860kb

input:

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

output:

99 363338635
99 367554753
99 607626555
99 590527039
99 821457493
99 608347645
99 886295828
99 109481192
99 272737165
99 864860843
99 440036078
99 25443117
99 816329476
99 874277272
99 109926923
99 789536607
99 232642964
99 497277845
99 891235872
99 863487000
99 748915115
99 642538741
99 427127645
99...

result:

ok 961 lines

Test #22:

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

input:

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

output:

30 385459332
30 376183046
30 45964427
30 903850258
30 693308023
30 417461816
30 387215244
30 602162530
30 227508048
30 452124202
30 122477915
30 761018490
30 324418627
30 362830721
30 136857925
30 495492071
30 8159553
30 639582794
30 291276708
30 156243913
30 372530781
30 109337250
30 28987820
30 68...

result:

ok 961 lines

Test #23:

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

input:

99 90 1000
K 74 13
K 82 76
K 12 88
K 83 20
K 57 28
K 9 50
K 26 17
K 50 90
K 87 90
K 87 88
K 15 66
K 88 89
K 87 10
K 44 72
K 73 27
K 13 1
K 38 11
K 83 58
K 72 80
K 87 46
K 60 72
K 4 33
K 77 20
K 85 62
K 62 36
K 69 67
K 67 43
K 36 38
K 59 16
K 16 28
K 64 72
K 3 29
K 25 79
K 5 14
K 9 90
K 75 74
K 63 12...

output:

98 353278188
98 825955607
98 666019901
98 926686765
98 942784866
98 720708980
98 718134142
98 245913719
98 142421941
98 886764382
98 871871226
98 41339358
98 732884664
98 608331108
98 100266214
98 910405667
98 112616956
98 826367085
98 820917327
98 610257623
98 752079533
98 432416795
98 847867059
98...

result:

ok 1000 lines

Test #24:

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

input:

100 100 1000
K 82 14
K 91 84
K 13 97
K 92 23
K 64 31
K 10 55
K 28 19
K 55 100
K 96 100
K 97 97
K 16 73
K 98 99
K 96 11
K 49 80
K 81 30
K 15 1
K 43 12
K 92 64
K 80 88
K 96 51
K 66 80
K 4 37
K 85 22
K 94 69
K 68 40
K 76 75
K 75 48
K 40 43
K 66 18
K 18 31
K 71 80
K 4 32
K 28 88
K 5 15
K 10 100
K 83 83
...

output:

99 728523098
99 671588485
99 335177647
99 325119987
99 617135448
99 82040727
99 496522933
99 198797328
99 325430219
99 620485452
99 929095415
99 423093765
99 302727745
99 614292459
99 232929403
99 382358409
99 537508907
99 456418284
99 609553235
99 993759537
99 343161681
99 344656732
99 367907274
99...

result:

ok 1000 lines

Subtask #7:

score: 15
Accepted

Dependency #6:

100%
Accepted

Test #25:

score: 15
Accepted
time: 0ms
memory: 15940kb

input:

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

output:

999998 59387335
999998 297580228
999998 685728664
999998 155139778
999998 347796012
999998 54876562
999998 763369529
999998 901839644
999998 370308928
999998 977268736
999998 537774212
999998 120011922
999998 490815704
999998 770881129
999998 983944149
999998 499413174
999998 263911380
999998 720219...

result:

ok 961 lines

Test #26:

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

input:

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

output:

536870910 18183805
536870910 354900857
536870910 856322913
536870910 957228410
536870910 689037860
536870910 732085753
536870910 844993788
536870910 468382650
536870910 328228711
536870910 230763902
536870910 989520977
536870910 277986299
536870910 699779663
536870910 484586759
536870910 964773408
5...

result:

ok 961 lines

Test #27:

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

input:

536870911 100 1000
K 82 14
K 91 84
K 13 97
K 92 23
K 64 31
K 10 55
K 28 19
K 55 100
K 96 100
K 97 97
K 16 73
K 98 99
K 96 11
K 49 80
K 81 30
K 15 1
K 43 12
K 92 64
K 80 88
K 96 51
K 66 80
K 4 37
K 85 22
K 94 69
K 68 40
K 76 75
K 75 48
K 40 43
K 66 18
K 18 31
K 71 80
K 4 32
K 28 88
K 5 15
K 10 100
K ...

output:

536870910 61290409
536870910 720769101
536870910 83757664
536870910 848275346
536870910 401815629
536870910 162978985
536870910 985495806
536870910 239657765
536870910 868236000
536870910 619484674
536870910 967639513
536870910 477996788
536870910 809538521
536870910 900162432
536870910 727082289
53...

result:

ok 1000 lines

Test #28:

score: 0
Accepted
time: 2ms
memory: 15228kb

input:

1000000000 100 1000
K 82 14
K 91 84
K 13 97
K 92 23
K 64 31
K 10 55
K 28 19
K 55 100
K 96 100
K 97 97
K 16 73
K 98 99
K 96 11
K 49 80
K 81 30
K 15 1
K 43 12
K 92 64
K 80 88
K 96 51
K 66 80
K 4 37
K 85 22
K 94 69
K 68 40
K 76 75
K 75 48
K 40 43
K 66 18
K 18 31
K 71 80
K 4 32
K 28 88
K 5 15
K 10 100
K...

output:

999999999 766316513
999999999 221668992
999999999 773434989
999999999 187858636
999999999 711175800
999999999 734055731
999999999 595067310
999999999 55364188
999999999 676292748
999999999 892558075
999999999 46329418
999999999 16869018
999999999 403755710
999999999 203166228
999999999 468296411
999...

result:

ok 1000 lines

Test #29:

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

input:

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

output:

123456788 483730448
123456788 991168270
123456788 583490429
123456788 328235333
123456788 247361429
123456788 615761774
123456788 48714054
123456788 561757629
123456788 689844361
123456788 702709223
123456788 869758983
123456788 261366781
123456788 284392623
123456788 5722972
123456788 270072505
123...

result:

ok 961 lines

Test #30:

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

input:

999888777 2 4
K 1 1
K 1 2
K 2 1
K 2 2

output:

999888776 82065707
999888776 82065707
999888776 82065707
999888776 82065707

result:

ok 4 lines

Test #31:

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

input:

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

output:

555444665 761547765
555444665 184815382
555444665 732406197
555444665 215759624
555444665 128462663
555444665 234891494
555444665 416572619
555444665 351555573
555444665 306543398
555444665 783057045
555444665 554426722
555444665 953122444
555444665 163415226
555444665 171102183
555444665 158187390
...

result:

ok 961 lines

Test #32:

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

input:

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

output:

987654320 965604545
987654320 513895684
987654320 394964464
987654320 826217249
987654320 338384385
987654320 888182207
987654320 714723331
987654320 239429994
987654320 707842567
987654320 139308227
987654320 112205215
987654320 580428353
987654320 45086261
987654320 466849965
987654320 969303431
9...

result:

ok 961 lines

Subtask #8:

score: 20
Accepted

Dependency #7:

100%
Accepted

Test #33:

score: 20
Accepted
time: 109ms
memory: 27732kb

input:

999999999 1000 1000
K 815 136
K 906 836
K 127 969
K 914 222
K 633 309
K 98 548
K 279 189
K 547 993
K 958 997
K 965 968
K 158 726
K 971 982
K 958 110
K 486 799
K 801 298
K 142 5
K 422 113
K 916 640
K 793 879
K 960 504
K 656 798
K 36 362
K 850 212
K 934 682
K 679 399
K 758 741
K 744 475
K 393 423
K 65...

output:

999999998 995779835
999999998 468218534
999999998 3993552
999999998 147529304
999999998 200529566
999999998 740989607
999999998 205208213
999999998 497163686
999999998 709963459
999999998 8924260
999999998 437677220
999999998 594341104
999999998 954089643
999999998 359751538
999999998 62337817
99999...

result:

ok 1000 lines

Test #34:

score: 0
Accepted
time: 130ms
memory: 27732kb

input:

536870911 1000 1000
K 815 136
K 906 836
K 127 969
K 914 222
K 633 309
K 98 548
K 279 189
K 547 993
K 958 997
K 965 968
K 158 726
K 971 982
K 958 110
K 486 799
K 801 298
K 142 5
K 422 113
K 916 640
K 793 879
K 960 504
K 656 798
K 36 362
K 850 212
K 934 682
K 679 399
K 758 741
K 744 475
K 393 423
K 65...

output:

536870910 152210403
536870910 702280288
536870910 357259152
536870910 953426375
536870910 189508013
536870910 821936138
536870910 311101349
536870910 798171410
536870910 202801799
536870910 475964904
536870910 989774143
536870910 774003283
536870910 641507489
536870910 542473661
536870910 590409247
...

result:

ok 1000 lines

Test #35:

score: 0
Accepted
time: 91ms
memory: 27388kb

input:

999333777 959 1000
K 782 130
K 869 801
K 122 930
K 876 212
K 607 296
K 94 525
K 268 181
K 525 953
K 919 956
K 926 929
K 152 697
K 931 941
K 918 106
K 466 766
K 768 285
K 137 5
K 405 108
K 879 614
K 760 843
K 921 484
K 629 766
K 35 347
K 815 204
K 896 654
K 651 383
K 727 711
K 713 456
K 377 405
K 629...

output:

999333776 366700166
999333776 297458024
999333776 904244313
999333776 582494539
999333776 143857457
999333776 170061420
999333776 674145192
999333776 939130423
999333776 365083962
999333776 984847110
999333776 826402296
999333776 55186516
999333776 982318984
999333776 435828585
999333776 490976799
9...

result:

ok 1000 lines

Test #36:

score: 0
Accepted
time: 90ms
memory: 27992kb

input:

785123555 1000 1000
K 815 136
K 906 836
K 127 969
K 914 222
K 633 309
K 98 548
K 279 189
K 547 993
K 958 997
K 965 968
K 158 726
K 971 982
K 958 110
K 486 799
K 801 298
K 142 5
K 422 113
K 916 640
K 793 879
K 960 504
K 656 798
K 36 362
K 850 212
K 934 682
K 679 399
K 758 741
K 744 475
K 393 423
K 65...

output:

785123554 806248944
785123554 244078899
785123554 157041313
785123554 317992392
785123554 614701943
785123554 67094506
785123554 306760361
785123554 199445201
785123554 889607340
785123554 812299427
785123554 617660162
785123554 952838588
785123554 576088875
785123554 650563828
785123554 741174188
7...

result:

ok 1000 lines

Test #37:

score: 0
Accepted
time: 107ms
memory: 27728kb

input:

765345234 1000 1000
K 815 136
K 906 836
K 127 969
K 914 222
K 633 309
K 98 548
K 279 189
K 547 993
K 958 997
K 965 968
K 158 726
K 971 982
K 958 110
K 486 799
K 801 298
K 142 5
K 422 113
K 916 640
K 793 879
K 960 504
K 656 798
K 36 362
K 850 212
K 934 682
K 679 399
K 758 741
K 744 475
K 393 423
K 65...

output:

765345233 126116700
765345233 864851430
765345233 761638552
765345233 654970992
765345233 147852345
765345233 191528260
765345233 143330731
765345233 528782166
765345233 700819816
765345233 775330420
765345233 1253378
765345233 294526162
765345233 168620805
765345233 609743818
765345233 626348151
76...

result:

ok 1000 lines

Subtask #9:

score: 7
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Dependency #7:

100%
Accepted

Dependency #8:

100%
Accepted

Test #38:

score: 7
Accepted
time: 128ms
memory: 27724kb

input:

536870911 1000 1000
B 815 136
K 906 836
B 127 969
K 914 222
B 633 309
B 98 548
K 279 189
K 547 993
B 958 997
B 965 968
B 158 726
B 971 982
B 958 110
B 486 799
B 801 298
B 142 5
B 422 113
K 916 640
B 793 879
B 960 504
B 656 798
B 36 362
B 850 212
B 934 682
B 679 399
B 758 741
B 744 475
B 393 423
B 65...

output:

0 0
536870910 702280288
537409 913547936
536870910 953426375
537409 705685633
537409 179210117
536870910 311101349
536870910 798171410
0 0
0 0
537409 649107599
0 0
537409 725702020
0 0
0 0
0 0
0 0
536870910 198851161
537410 452077544
537409 812003324
537410 646603535
537409 554765369
537409 76692674...

result:

ok 1000 lines

Test #39:

score: 0
Accepted
time: 109ms
memory: 27708kb

input:

1000000000 1000 1000
B 136 906
B 127 969
B 222 633
R 98 548
R 189 547
B 958 997
B 968 158
K 971 982
B 110 486
K 801 298
P 5 422
P 916 640
K 879 960
Q 656 798
P 362 850
R 934 682
K 399 758
K 744 475
R 423 656
P 172 302
K 798 32
R 277 873
P 150 98
B 824 822
K 126 318
K 951 491
P 664 664
P 382 211
K 52...

output:

0 0
0 0
1001002 28913847
2 2
2 2
1001002 260698720
0 0
999999999 639797982
0 0
999999999 865619692
0 0
0 0
999999999 939318093
2 4
0 0
2 2
999999999 381289904
999999999 53601004
2 2
0 0
999999999 424057099
2 2
0 0
0 0
999999999 14780564
999999999 868525350
999999999 1
0 0
999999999 89643519
0 0
2 4
...

result:

ok 1000 lines

Test #40:

score: 0
Accepted
time: 3ms
memory: 14156kb

input:

13 13 845
P 1 1
P 1 2
P 1 3
P 1 4
P 1 5
P 1 6
P 1 7
P 1 8
P 1 9
P 1 10
P 1 11
P 1 12
P 1 13
P 2 1
P 2 2
P 2 3
P 2 4
P 2 5
P 2 6
P 2 7
P 2 8
P 2 9
P 2 10
P 2 11
P 2 12
P 2 13
P 3 1
P 3 2
P 3 3
P 3 4
P 3 5
P 3 6
P 3 7
P 3 8
P 3 9
P 3 10
P 3 11
P 3 12
P 3 13
P 4 1
P 4 2
P 4 3
P 4 4
P 4 5
P 4 6
P 4 7
P ...

output:

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

result:

ok 845 lines

Test #41:

score: 0
Accepted
time: 100ms
memory: 27976kb

input:

125000000 999 1000
B 136 905
B 127 968
B 221 632
R 98 547
R 189 547
B 957 996
B 967 158
K 970 981
B 110 485
K 800 297
P 5 5
P 915 640
K 878 959
Q 656 798
P 361 849
R 934 681
K 399 757
K 743 475
R 422 655
P 172 302
K 797 32
R 277 872
P 149 98
B 823 822
K 126 317
K 950 491
P 663 439
P 382 210
K 52 795...

output:

125251 530364697
125251 144477269
125252 456800414
2 2
2 2
125252 371322995
125251 132486781
124999999 347510715
125252 13930694
124999999 593688076
124999999 1
0 0
124999999 48395133
2 4
0 0
2 2
124999999 113980370
124999999 462099083
2 2
0 0
124999999 199552763
2 2
0 0
125252 60268284
124999999 71...

result:

ok 1000 lines

Test #42:

score: 0
Accepted
time: 3ms
memory: 15460kb

input:

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

output:

13 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
13 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
13 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
13 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
13 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...

result:

ok 980 lines

Extra Test:

score: 0
Extra Test Passed