結果

問題 No.60 魔法少女
ユーザー takakintakakin
提出日時 2020-07-09 21:54:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 249 ms / 5,000 ms
コード長 563 bytes
コンパイル時間 369 ms
コンパイル使用メモリ 82,532 KB
実行使用メモリ 107,632 KB
最終ジャッジ日時 2024-04-17 02:02:42
合計ジャッジ時間 3,971 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 100 ms
91,900 KB
testcase_01 AC 101 ms
91,824 KB
testcase_02 AC 114 ms
91,776 KB
testcase_03 AC 105 ms
91,676 KB
testcase_04 AC 168 ms
96,480 KB
testcase_05 AC 191 ms
107,380 KB
testcase_06 AC 230 ms
106,868 KB
testcase_07 AC 208 ms
103,176 KB
testcase_08 AC 182 ms
101,528 KB
testcase_09 AC 167 ms
96,768 KB
testcase_10 AC 219 ms
106,992 KB
testcase_11 AC 163 ms
87,420 KB
testcase_12 AC 177 ms
102,716 KB
testcase_13 AC 249 ms
107,632 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