結果
問題 |
No.60 魔法少女
|
ユーザー |
![]() |
提出日時 | 2020-12-25 19:19:42 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 989 ms / 5,000 ms |
コード長 | 618 bytes |
コンパイル時間 | 232 ms |
コンパイル使用メモリ | 12,928 KB |
実行使用メモリ | 89,996 KB |
最終ジャッジ日時 | 2024-09-22 12:46:29 |
合計ジャッジ時間 | 15,443 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
ソースコード
import numpy as np import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) U = 1000 N, K = map(int, input().split()) xyh = np.array([input().split() for _ in range(N)], dtype=np.int64) x, y, h, w, d = np.array([input().split() for _ in range(K)], dtype=np.int64).T x += U y += U G = np.zeros((2*U+2, 2*U+2), dtype=np.int64) np.add.at(G, (x, y), d) np.add.at(G, (x + h + 1, y), -d) np.add.at(G, (x, y + w + 1), -d) np.add.at(G, (x + h + 1, y + w + 1), d) np.cumsum(G, axis=0, out=G) np.cumsum(G, axis=1, out=G) x, y, h = xyh.T x += U y += U rest = h - G[x, y] rest[rest < 0] = 0 print(rest.sum())