結果

問題 No.60 魔法少女
ユーザー chocoruskchocorusk
提出日時 2020-09-10 05:19:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,199 ms / 5,000 ms
コード長 682 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 11,000 KB
実行使用メモリ 80,352 KB
最終ジャッジ日時 2023-08-22 21:41:34
合計ジャッジ時間 13,548 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 488 ms
16,272 KB
testcase_01 AC 476 ms
16,200 KB
testcase_02 AC 476 ms
16,104 KB
testcase_03 AC 497 ms
23,888 KB
testcase_04 AC 937 ms
63,552 KB
testcase_05 AC 887 ms
65,900 KB
testcase_06 AC 1,163 ms
78,112 KB
testcase_07 AC 992 ms
69,240 KB
testcase_08 AC 821 ms
61,300 KB
testcase_09 AC 680 ms
53,380 KB
testcase_10 AC 1,133 ms
75,644 KB
testcase_11 AC 571 ms
49,872 KB
testcase_12 AC 768 ms
59,912 KB
testcase_13 AC 1,199 ms
80,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read=sys.stdin.buffer.read
readline=sys.stdin.buffer.readline
readlines=sys.stdin.buffer.readlines

n, k=map(int, readline().split())
myon=list(map(int, read().split()))
xyh=myon[:3*n]
awhd=myon[3*n:]
s=[[0]*1002 for _ in range(1002)]
for ax, ay, w, h, d in zip(*[iter(awhd)]*5):
    ax+=500
    ay+=500
    s[ax][ay]+=d
    bx, by=min(ax+w+1, 1001), min(ay+h+1, 1001)
    s[bx][ay]-=d
    s[ax][by]-=d
    s[bx][by]+=d
for i in range(1001):
    for j in range(1000):
        s[i][j+1]+=s[i][j]
for i in range(1000):
    for j in range(1001):
        s[i+1][j]+=s[i][j]
ans=0
for x, y, h in zip(*[iter(xyh)]*3):
    x+=500
    y+=500
    ans+=max(0, h-s[x][y])
print(ans)
0