結果

問題 No.60 魔法少女
ユーザー vwxyzvwxyz
提出日時 2022-06-29 15:26:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,895 ms / 5,000 ms
コード長 663 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 11,004 KB
実行使用メモリ 119,700 KB
最終ジャッジ日時 2023-08-14 18:39:59
合計ジャッジ時間 36,515 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,901 ms
39,656 KB
testcase_01 AC 1,902 ms
39,708 KB
testcase_02 AC 1,892 ms
39,656 KB
testcase_03 AC 1,966 ms
51,612 KB
testcase_04 AC 2,537 ms
111,028 KB
testcase_05 AC 2,505 ms
118,768 KB
testcase_06 AC 2,789 ms
118,752 KB
testcase_07 AC 2,587 ms
115,976 KB
testcase_08 AC 2,476 ms
114,576 KB
testcase_09 AC 2,484 ms
110,136 KB
testcase_10 AC 2,781 ms
118,912 KB
testcase_11 AC 2,108 ms
99,312 KB
testcase_12 AC 2,341 ms
114,668 KB
testcase_13 AC 2,895 ms
119,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline

N,K=map(int,readline().split())
X,Y,HP=[],[],[]
for _ in range(N):
    x,y,hp=map(int,readline().split())
    x+=500;y+=500
    X.append(x)
    Y.append(y)
    HP.append(hp)
imos=[[0]*2001 for i in range(2001)]
for _ in range(K):
    x,y,w,h,d=map(int,readline().split())
    x+=500;y+=500
    w+=1;h+=1
    imos[x+w][y+h]+=d
    imos[x][y+h]-=d
    imos[x+w][y]-=d
    imos[x][y]+=d
for i in range(2001):
    for j in range(1,2001):
        imos[i][j]+=imos[i][j-1]
for i in range(1,2001):
    for j in range(2001):
        imos[i][j]+=imos[i-1][j]
ans=0
for x,y,hp in zip(X,Y,HP):
    ans+=max(0,hp-imos[x][y])
print(ans)
0