結果

問題 No.60 魔法少女
ユーザー KudeKude
提出日時 2020-09-07 06:59:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 337 ms / 5,000 ms
コード長 674 bytes
コンパイル時間 327 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 113,900 KB
最終ジャッジ日時 2023-08-19 16:22:39
合計ジャッジ時間 5,385 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
76,116 KB
testcase_01 AC 123 ms
76,328 KB
testcase_02 AC 124 ms
76,072 KB
testcase_03 AC 125 ms
76,064 KB
testcase_04 AC 271 ms
91,720 KB
testcase_05 AC 280 ms
112,580 KB
testcase_06 AC 328 ms
112,024 KB
testcase_07 AC 287 ms
105,116 KB
testcase_08 AC 248 ms
101,412 KB
testcase_09 AC 199 ms
92,168 KB
testcase_10 AC 320 ms
112,296 KB
testcase_11 AC 157 ms
92,836 KB
testcase_12 AC 246 ms
105,320 KB
testcase_13 AC 337 ms
113,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s = [[0] * 1002 for _ in range(1002)]
n, k = map(int, input().split())
enemies = [map(int, input().split()) for _ in range(n)]
for _ in range(k):
    ax, ay, w, h, d = map(int, input().split())
    ax += 500
    ay += 500
    bx = min(1001, ax + w + 1)
    by = min(1001, ay + h + 1)
    s[ax][ay] += d
    s[ax][by] -= d
    s[bx][ay] -= d
    s[bx][by] += d

for i in range(1002):
    now = 0
    for j in range(1002):
        now += s[i][j]
        s[i][j] = now

for j in range(1002):
    now = 0
    for i in range(1002):
        now += s[i][j]
        s[i][j] = now

ans = 0
for x, y, hp in enemies:
    x += 500
    y += 500
    ans += max(0, hp - s[x][y])
print(ans)
0