結果
| 問題 |
No.60 魔法少女
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-04-14 12:44:58 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 911 ms / 5,000 ms |
| コード長 | 1,069 bytes |
| コンパイル時間 | 104 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 69,152 KB |
| 最終ジャッジ日時 | 2024-07-18 15:15:39 |
| 合計ジャッジ時間 | 8,834 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 10 |
ソースコード
import sys
def solve():
N, K = map(int, sys.stdin.readline().split())
teki = dict()
for i in range(N):
x, y, hp = map(int, sys.stdin.readline().split())
x += 500
y += 500
teki[(y, x)] = hp
kougeki = [[0] * (1000 + 1) for i in range(1000 + 1)]
for i in range(K):
ax, ay, w, h, d = map(int, sys.stdin.readline().split())
ax += 500
ay += 500
kougeki[ay][ax] += d
if ax + w + 1 < 1000 + 1:
kougeki[ay][ax + w + 1] -= d
if ay + h + 1 < 1000 + 1:
kougeki[ay + h + 1][ax] -= d
if ax + w + 1 < 1000 + 1 and ay + h + 1 < 1000 + 1:
kougeki[ay + h + 1][ax + w + 1] += d
for i in range(1000 + 1):
for j in range(1000):
kougeki[i][j + 1] += kougeki[i][j]
for j in range(1000 + 1):
for i in range(1000):
kougeki[i + 1][j] += kougeki[i][j]
ans = 0
for (y, x), hp in teki.items():
ans += max(0, hp - kougeki[y][x])
print(ans)
if __name__ == '__main__':
solve()