QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#503805#3892. Efficiently Elevatedxiaowuc1AC ✓43ms8060kbC++172.0kb2024-08-04 01:23:042024-08-04 01:23:04

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 3
1 2 3
0 0 4
7 6 5

output:

1

result:

ok single line: '1'

Test #2:

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

input:

6 7
0 0 0 0 0 0 0
0 1 2 3 2 1 0
0 1 2 3 2 1 0
0 0 0 0 0 0 0
0 1 0 5 0 0 0
0 0 0 0 0 0 0

output:

2

result:

ok single line: '2'

Test #3:

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

input:

4 4
1 1 2 1
2 2 1 2
1 2 2 1
2 1 2 2

output:

4

result:

ok single line: '4'

Test #4:

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

input:

50 25
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 5 0 0 0 0 10 10 0 10 10 0 10 11 0 10 10 0 0 0 0 0 0
0 0 0 4 0 0 0 0 10 0 0 0 10 0 10 0 0 0 11 0 0 0 0 0 0
0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5 4 3 0 3 4 5 0 10 0 0 0 10 0 11 0 0 0 10 0 0 0 0 0 0
0 0 0 3 0 0 0 0 10 10 0 10 1...

output:

28

result:

ok single line: '28'

Test #5:

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

input:

500 500
999999999 1000000000 999999999 1000000000 999999999 1000000000 999999999 1000000000 999999999 1000000000 999999999 1000000000 999999999 1000000000 999999999 1000000000 999999999 1000000000 999999999 1000000000 999999999 1000000000 999999999 1000000000 999999999 1000000000 999999999 100000000...

output:

125000

result:

ok single line: '125000'

Test #6:

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

input:

15 15
0 2 0 2 0 2 0 2 0 2 0 2 0 2 0
2 0 2 0 2 0 2 0 2 0 2 0 2 0 2
0 2 0 2 0 2 0 2 0 2 0 2 0 2 0
2 0 2 0 2 0 2 0 2 0 2 0 2 0 2
0 2 0 2 0 2 0 2 0 2 0 2 0 2 0
2 0 2 0 2 0 2 0 2 0 2 0 2 0 2
0 2 0 2 0 2 0 2 0 2 0 2 0 2 0
2 0 2 0 2 0 2 0 2 0 2 0 2 0 2
0 2 0 2 0 2 0 2 0 2 0 2 0 2 0
2 0 2 0 2 0 2 0 2 0 2 0 ...

output:

112

result:

ok single line: '112'

Test #7:

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

input:

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

output:

0

result:

ok single line: '0'

Test #8:

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

input:

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

output:

0

result:

ok single line: '0'

Test #9:

score: 0
Accepted
time: 7ms
memory: 4536kb

input:

500 500
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

0

result:

ok single line: '0'

Test #10:

score: 0
Accepted
time: 7ms
memory: 4536kb

input:

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

output:

0

result:

ok single line: '0'

Test #11:

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

input:

500 500
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000...

output:

1

result:

ok single line: '1'

Test #12:

score: 0
Accepted
time: 18ms
memory: 8060kb

input:

500 500
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 ...

output:

1

result:

ok single line: '1'

Test #13:

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

input:

1 1
0

output:

0

result:

ok single line: '0'

Test #14:

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

input:

1 1
1

output:

0

result:

ok single line: '0'

Test #15:

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

input:

1 1
1000000000

output:

1

result:

ok single line: '1'

Test #16:

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

input:

10 9
0 0 1 0 2 0 1 0 0
0 0 1 0 2 0 1 0 0
1 1 1 0 2 1 1 1 1
0 0 0 0 2 0 0 0 0
2 2 2 2 2 0 0 0 0
0 0 0 0 3 0 0 0 0
3 4 0 0 3 0 0 0 0
4 3 0 0 3 3 3 3 3
0 0 0 0 0 0 3 0 0
0 0 0 0 0 0 3 0 0

output:

3

result:

ok single line: '3'

Test #17:

score: 0
Accepted
time: 9ms
memory: 5228kb

input:

203 347
916879845 937252694 391022453 89978003 634030332 101731698 199528945 450823909 524744922 774250323 39638192 517746918 830485529 452142636 741348119 555845267 107263418 722556774 795717747 567823766 825040544 169255395 517070719 223142167 923428116 423752899 166792882 158836574 927142878 8235...

output:

14176

result:

ok single line: '14176'

Test #18:

score: 0
Accepted
time: 13ms
memory: 5256kb

input:

205 340
726076542 181100235 920613657 864898375 676032496 496171094 482877205 939574823 762838372 416503168 606104252 378710090 238226335 461877359 942229157 14897166 304137670 506161531 49688420 917414359 506105765 605549799 909318331 964271911 995466513 743286187 446279959 435239713 615755979 9233...

output:

14016

result:

ok single line: '14016'

Test #19:

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

input:

297 255
253839767 967646098 397602969 942498651 529467712 953789754 864204377 754263600 444320 897881492 461791799 74498526 143334763 567761007 182366942 396881807 262116243 983155946 293871931 791570192 386677171 895578474 113311052 352249745 41054946 135884283 724596375 160820600 133021189 2772287...

output:

15142

result:

ok single line: '15142'

Test #20:

score: 0
Accepted
time: 14ms
memory: 5236kb

input:

231 312
520126674 157702860 923320499 660326482 668521669 580244095 951168333 498603330 735803102 430822254 669831190 474558460 906248258 198177524 163812924 101684810 896945102 765867146 856937335 987948886 922866560 998783457 145564692 721026445 820933487 167212611 450519836 19979372 664762039 714...

output:

14428

result:

ok single line: '14428'

Test #21:

score: 0
Accepted
time: 11ms
memory: 5188kb

input:

500 500
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

3

result:

ok single line: '3'

Test #22:

score: 0
Accepted
time: 12ms
memory: 5192kb

input:

500 500
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

3

result:

ok single line: '3'

Test #23:

score: 0
Accepted
time: 12ms
memory: 5188kb

input:

500 500
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

3

result:

ok single line: '3'

Test #24:

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

input:

500 500
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

3

result:

ok single line: '3'

Test #25:

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

input:

500 500
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

2

result:

ok single line: '2'

Test #26:

score: 0
Accepted
time: 14ms
memory: 5184kb

input:

500 500
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

5

result:

ok single line: '5'

Test #27:

score: 0
Accepted
time: 39ms
memory: 8044kb

input:

500 500
6 6 0 4 8 7 6 4 7 5 9 3 8 2 4 2 1 9 4 8 9 2 4 1 1 10 5 7 8 1 5 6 5 9 10 3 8 7 7 8 4 0 8 0 1 6 10 10 0 9 7 5 3 5 1 3 9 3 3 2 8 7 1 1 5 8 7 1 4 8 4 1 8 5 8 3 9 8 9 4 7 1 9 6 5 9 3 4 2 3 2 0 9 10 4 7 1 1 10 2 2 0 1 8 10 6 8 4 8 3 3 10 9 6 9 4 7 7 10 10 5 1 5 9 1 7 9 10 5 3 3 0 4 1 3 5 2 5 6 0 1...

output:

45595

result:

ok single line: '45595'

Test #28:

score: 0
Accepted
time: 43ms
memory: 6924kb

input:

500 500
2 9 1 4 1 7 7 7 10 6 3 1 7 0 6 6 9 0 7 4 3 9 1 5 0 0 0 10 8 0 6 10 3 6 0 8 3 7 7 8 3 5 3 10 3 7 4 0 6 8 10 1 2 10 4 1 5 8 6 8 10 3 4 4 9 7 8 6 9 0 7 3 6 6 10 2 5 8 10 5 1 7 10 8 1 2 8 6 5 7 0 7 0 4 9 9 9 6 10 2 2 8 3 0 3 8 8 3 6 8 5 9 5 7 4 10 8 9 0 6 8 2 8 8 3 6 0 7 5 9 8 3 8 6 7 5 6 5 0 8 ...

output:

45263

result:

ok single line: '45263'

Test #29:

score: 0
Accepted
time: 19ms
memory: 5536kb

input:

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

output:

31316

result:

ok single line: '31316'

Test #30:

score: 0
Accepted
time: 23ms
memory: 5556kb

input:

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

output:

30852

result:

ok single line: '30852'

Test #31:

score: 0
Accepted
time: 26ms
memory: 6148kb

input:

500 500
3 3 0 2 3 3 2 3 2 1 1 2 1 0 2 1 2 0 0 2 3 0 2 3 2 1 3 3 2 0 0 0 3 0 3 2 1 2 0 1 1 1 1 3 0 0 2 3 0 2 2 0 2 1 2 3 0 3 2 1 2 1 1 1 0 2 3 0 0 1 1 0 0 3 2 1 1 3 2 3 3 2 0 2 0 3 2 1 1 0 2 0 1 2 1 2 3 0 0 1 1 0 0 0 0 1 0 3 0 2 0 0 0 1 1 0 3 1 0 0 3 0 2 0 1 0 2 2 3 1 0 3 0 0 3 1 2 2 3 1 1 0 1 1 2 2 ...

output:

36989

result:

ok single line: '36989'

Test #32:

score: 0
Accepted
time: 26ms
memory: 7308kb

input:

500 500
3 3 0 2 4 3 3 2 3 2 4 1 4 1 2 1 0 4 2 4 4 1 2 0 0 2 3 4 0 2 3 2 4 1 4 3 3 4 2 0 4 0 0 3 0 4 3 2 1 2 0 1 4 1 1 1 4 3 0 0 2 4 3 0 2 4 2 0 4 2 4 1 4 4 4 2 3 0 4 3 2 4 1 2 1 1 1 0 4 2 3 0 0 1 1 0 0 4 3 4 2 4 1 1 4 3 4 2 3 3 2 0 2 4 0 3 4 2 1 1 0 2 0 1 2 1 2 3 0 0 1 1 0 4 4 4 0 0 0 1 4 4 0 3 0 2 ...

output:

39825

result:

ok single line: '39825'

Test #33:

score: 0
Accepted
time: 17ms
memory: 6028kb

input:

500 500
1 0 1995 1994 1993 1992 1991 1990 1989 1988 1987 1986 1985 1984 1983 1982 1981 1980 1979 1978 1977 1976 1975 1974 1973 1972 1971 1970 1969 1968 1967 1966 1965 1964 1963 1962 1961 1960 1959 1958 1957 1956 1955 1954 1953 1952 1951 1950 1949 1948 1947 1946 1945 1944 1943 1942 1941 1940 1939 193...

output:

1

result:

ok single line: '1'

Test #34:

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

input:

35 500
1 0 1065 1064 1063 1062 1061 1060 1059 1058 1057 1056 1055 1054 1053 1052 1051 1050 1049 1048 1047 1046 1045 1044 1043 1042 1041 1040 1039 1038 1037 1036 1035 1034 1033 1032 1031 1030 1029 1028 1027 1026 1025 1024 1023 1022 1021 1020 1019 1018 1017 1016 1015 1014 1013 1012 1011 1010 1009 1008...

output:

1

result:

ok single line: '1'

Test #35:

score: 0
Accepted
time: 17ms
memory: 6068kb

input:

500 500
7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 ...

output:

1

result:

ok single line: '1'

Test #36:

score: 0
Accepted
time: 17ms
memory: 6128kb

input:

500 500
7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 7 7 7 0 ...

output:

1

result:

ok single line: '1'