結果

問題 No.60 魔法少女
ユーザー zonzo34zonzo34
提出日時 2021-12-24 10:21:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 348 ms / 5,000 ms
コード長 590 bytes
コンパイル時間 972 ms
コンパイル使用メモリ 81,428 KB
実行使用メモリ 124,680 KB
最終ジャッジ日時 2023-10-19 11:07:14
合計ジャッジ時間 5,308 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
91,112 KB
testcase_01 AC 101 ms
91,124 KB
testcase_02 AC 102 ms
91,124 KB
testcase_03 AC 104 ms
91,108 KB
testcase_04 AC 252 ms
114,032 KB
testcase_05 AC 282 ms
124,304 KB
testcase_06 AC 339 ms
124,424 KB
testcase_07 AC 294 ms
120,568 KB
testcase_08 AC 251 ms
118,848 KB
testcase_09 AC 207 ms
114,404 KB
testcase_10 AC 330 ms
124,328 KB
testcase_11 AC 166 ms
111,884 KB
testcase_12 AC 247 ms
120,632 KB
testcase_13 AC 348 ms
124,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
wal=[]
for i in range(N):
    x,y,hp=map(int,input().split())
    x,y=x+500,y+500
    wal.append((x,y,hp))

imos=[[0]*1510 for _ in range(1510)]
sm=[[0]*1510 for _ in range(1510)]
for i in range(K):
    ax,ay,w,h,d=map(int,input().split())
    ax,ay=ax+500,ay+500
    imos[ax][ay]+=d
    imos[ax+w+1][ay]-=d
    imos[ax][ay+h+1]-=d
    imos[ax+w+1][ay+h+1]+=d

for i in range(1500):
    for j in range(1500):
        sm[i+1][j+1]=sm[i][j+1]+sm[i+1][j]-sm[i][j]+imos[i][j]

ans=0
for x,y,hp in wal:
    if sm[x+1][y+1]<hp:
        ans+=hp-sm[x+1][y+1]
print(ans)
0