Submission #24343777
Source Code Expand
(H,W,C),*A=[[*map(int,s.split())]for s in open(0)] def f(A,r=4e9,i=0): D=[r]*W*H for a in A: for a in a:D[i]=min(a,x:=min(D[i-W],D[i-(i%W>0)])+C);r=min(r,x+a);i+=1 return r print(f(A[::-1],f(A)))
Submission Info
| Submission Time | |
|---|---|
| Task | D - National Railway |
| User | Pandruant |
| Language | Python (3.8.2) |
| Score | 400 |
| Code Size | 200 Byte |
| Status | AC |
| Exec Time | 1530 ms |
| Memory | 89120 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 400 / 400 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example0.txt, example1.txt |
| All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, 028.txt, 029.txt, 030.txt, 031.txt, example0.txt, example1.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 000.txt | AC | 41 ms | 9680 KiB |
| 001.txt | AC | 37 ms | 9516 KiB |
| 002.txt | AC | 37 ms | 9748 KiB |
| 003.txt | AC | 38 ms | 9816 KiB |
| 004.txt | AC | 35 ms | 9360 KiB |
| 005.txt | AC | 39 ms | 9348 KiB |
| 006.txt | AC | 40 ms | 9808 KiB |
| 007.txt | AC | 38 ms | 9436 KiB |
| 008.txt | AC | 1475 ms | 89120 KiB |
| 009.txt | AC | 1483 ms | 88696 KiB |
| 010.txt | AC | 1461 ms | 57064 KiB |
| 011.txt | AC | 1482 ms | 88624 KiB |
| 012.txt | AC | 1467 ms | 88572 KiB |
| 013.txt | AC | 1481 ms | 88572 KiB |
| 014.txt | AC | 1492 ms | 65704 KiB |
| 015.txt | AC | 1527 ms | 78972 KiB |
| 016.txt | AC | 1530 ms | 71588 KiB |
| 017.txt | AC | 1499 ms | 80196 KiB |
| 018.txt | AC | 1481 ms | 66012 KiB |
| 019.txt | AC | 1513 ms | 66696 KiB |
| 020.txt | AC | 572 ms | 35304 KiB |
| 021.txt | AC | 697 ms | 41728 KiB |
| 022.txt | AC | 248 ms | 20240 KiB |
| 023.txt | AC | 242 ms | 17764 KiB |
| 024.txt | AC | 117 ms | 13032 KiB |
| 025.txt | AC | 22 ms | 9136 KiB |
| 026.txt | AC | 21 ms | 9016 KiB |
| 027.txt | AC | 25 ms | 9088 KiB |
| 028.txt | AC | 1435 ms | 57616 KiB |
| 029.txt | AC | 1406 ms | 40912 KiB |
| 030.txt | AC | 1475 ms | 88504 KiB |
| 031.txt | AC | 1497 ms | 87488 KiB |
| example0.txt | AC | 24 ms | 8904 KiB |
| example1.txt | AC | 19 ms | 9196 KiB |