結果

問題 No.60 魔法少女
ユーザー 👑 rin204rin204
提出日時 2022-07-05 21:09:43
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 369 ms / 5,000 ms
コード長 625 bytes
コンパイル時間 790 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 120,008 KB
最終ジャッジ日時 2023-08-22 11:03:27
合計ジャッジ時間 6,355 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
93,028 KB
testcase_01 AC 133 ms
92,804 KB
testcase_02 AC 133 ms
92,940 KB
testcase_03 AC 131 ms
92,880 KB
testcase_04 AC 278 ms
111,588 KB
testcase_05 AC 311 ms
119,240 KB
testcase_06 AC 365 ms
119,224 KB
testcase_07 AC 319 ms
116,512 KB
testcase_08 AC 274 ms
115,252 KB
testcase_09 AC 230 ms
111,748 KB
testcase_10 AC 353 ms
119,452 KB
testcase_11 AC 188 ms
101,400 KB
testcase_12 AC 274 ms
116,476 KB
testcase_13 AC 369 ms
120,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
enemy = [list(map(int, input().split())) for _ in range(n)]
dp = [[0] * 2000 for _ in range(2000)]
plus = 600
for _ in range(k):
    x1, y1, w, h, d = map(int, input().split())
    x1 += plus
    y1 += plus
    x2 = x1 + w + 1
    y2 = y1 + h + 1
    dp[x1][y1] += d
    dp[x1][y2] -= d
    dp[x2][y1] -= d
    dp[x2][y2] += d
for i in range(1700):
    for j in range(1700):
        dp[i][j + 1] += dp[i][j]
for i in range(1700):
    for j in range(1700):
        dp[i + 1][j] += dp[i][j]

ans = 0
for x, y, hp in enemy:
    x += plus
    y += plus
    ans += max(0, hp - dp[x][y])
print(ans)
0