結果

問題 No.60 魔法少女
ユーザー zonzo34zonzo34
提出日時 2021-12-25 17:16:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 316 ms / 5,000 ms
コード長 608 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 81,812 KB
実行使用メモリ 106,708 KB
最終ジャッジ日時 2023-10-21 18:39:23
合計ジャッジ時間 4,283 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
91,384 KB
testcase_01 AC 95 ms
91,396 KB
testcase_02 AC 96 ms
91,416 KB
testcase_03 AC 97 ms
91,384 KB
testcase_04 AC 232 ms
96,404 KB
testcase_05 AC 254 ms
106,568 KB
testcase_06 AC 313 ms
105,944 KB
testcase_07 AC 265 ms
102,596 KB
testcase_08 AC 227 ms
101,532 KB
testcase_09 AC 178 ms
96,800 KB
testcase_10 AC 303 ms
106,572 KB
testcase_11 AC 137 ms
90,244 KB
testcase_12 AC 219 ms
102,580 KB
testcase_13 AC 316 ms
106,708 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)]

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][ay+h+1]-=d
    imos[ax+w+1][ay]-=d
    imos[ax+w+1][ay+h+1]+=d

for i in range(1500):
    for j in range(1500):
        imos[i+1][j]+=imos[i][j]
for i in range(1500):
    for j in range(1500):
        imos[i][j+1]+=imos[i][j]
    
ans=0
for x,y,hp in wal:
    if imos[x][y]<hp:
        ans+=hp-imos[x][y]
print(ans)
0