Submission #16008230


Source Code Expand

Copy
import numpy as np
import sys
input = sys.stdin.readline


def main():
    h, w, k = map(int, input().split())
    values = np.zeros((h, w), dtype=np.int64)
    items = np.array([list(map(int, input().split())) for _ in range(k)])
    ys, xs, vs = items[:, 0] - 1, items[:, 1] - 1, items[:, 2]
    values[ys, xs] = vs

    DP = np.zeros(w + 1, dtype=np.int64)
    for line in values:
        DP[1:] += line
        DP = np.maximum.accumulate(DP)
        for _ in range(2):
            DP[1:] = np.maximum(DP[:-1] + line, DP[1:])
            DP = np.maximum.accumulate(DP)
    print(DP[-1])


if __name__ == "__main__":
    main()

Submission Info

Submission Time
Task E - Picking Goods
User parsely
Language Python (3.8.2)
Score 500
Code Size 654 Byte
Status
Exec Time 536 ms
Memory 105332 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
× 3
× 37
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
01.txt 112 ms 26788 KB
02.txt 112 ms 27068 KB
03.txt 113 ms 27104 KB
04.txt 114 ms 27272 KB
05.txt 115 ms 27144 KB
06.txt 114 ms 27104 KB
07.txt 116 ms 27196 KB
08.txt 117 ms 27180 KB
09.txt 118 ms 27428 KB
10.txt 106 ms 27192 KB
11.txt 112 ms 27052 KB
12.txt 533 ms 105332 KB
13.txt 530 ms 105064 KB
14.txt 536 ms 104840 KB
15.txt 528 ms 104776 KB
16.txt 527 ms 104976 KB
17.txt 211 ms 27216 KB
18.txt 231 ms 37780 KB
19.txt 222 ms 28520 KB
20.txt 225 ms 36980 KB
21.txt 508 ms 73656 KB
22.txt 497 ms 67396 KB
23.txt 194 ms 36064 KB
24.txt 197 ms 37580 KB
25.txt 136 ms 27008 KB
26.txt 111 ms 27636 KB
27.txt 321 ms 52632 KB
28.txt 286 ms 49712 KB
29.txt 344 ms 98636 KB
30.txt 495 ms 103600 KB
31.txt 294 ms 93404 KB
32.txt 289 ms 91868 KB
33.txt 338 ms 97952 KB
34.txt 383 ms 101000 KB
s1.txt 116 ms 26944 KB
s2.txt 116 ms 27000 KB
s3.txt 118 ms 27072 KB