結果

問題 No.60 魔法少女
ユーザー takakintakakin
提出日時 2020-07-09 21:53:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,710 ms / 5,000 ms
コード長 563 bytes
コンパイル時間 415 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 113,152 KB
最終ジャッジ日時 2024-04-17 02:02:37
合計ジャッジ時間 30,845 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,207 ms
28,288 KB
testcase_01 AC 1,215 ms
28,416 KB
testcase_02 AC 1,225 ms
28,288 KB
testcase_03 AC 1,334 ms
40,320 KB
testcase_04 AC 2,282 ms
100,480 KB
testcase_05 AC 2,245 ms
111,872 KB
testcase_06 AC 2,699 ms
111,872 KB
testcase_07 AC 2,358 ms
108,160 KB
testcase_08 AC 2,161 ms
105,856 KB
testcase_09 AC 1,919 ms
99,840 KB
testcase_10 AC 2,646 ms
112,128 KB
testcase_11 AC 1,623 ms
88,832 KB
testcase_12 AC 2,112 ms
106,624 KB
testcase_13 AC 2,710 ms
113,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n,k=map(int,input().split())
XY=[]
for _ in range(n):
  XY.append(tuple(map(int,input().split())))
T=[[0]*(1502) for _ in range(1502)]
for _ in range(k):
  ax,ay,w,h,d=map(int,input().split())
  ax+=500
  ay+=500
  T[ax][ay]+=d
  T[ax+w+1][ay]-=d
  T[ax][ay+h+1]-=d
  T[ax+w+1][ay+h+1]+=d
for i in range(1502):
  for j in range(1,1502):
    T[i][j]+=T[i][j-1]
for i in range(1502):
  for j in range(1,1502):
    T[j][i]+=T[j-1][i]
ans=0
for x,y,hp in XY:
  x+=500
  y+=500
  ans+=max(0,hp-T[x][y])
print(ans)
0