結果

問題 No.60 魔法少女
ユーザー roiti46roiti46
提出日時 2015-02-18 03:11:47
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 365 ms / 5,000 ms
コード長 669 bytes
コンパイル時間 956 ms
コンパイル使用メモリ 77,844 KB
実行使用メモリ 97,052 KB
最終ジャッジ日時 2023-09-06 01:58:42
合計ジャッジ時間 4,900 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 145 ms
79,896 KB
testcase_01 AC 147 ms
80,028 KB
testcase_02 AC 151 ms
80,416 KB
testcase_03 AC 149 ms
79,940 KB
testcase_04 AC 277 ms
96,240 KB
testcase_05 AC 291 ms
96,376 KB
testcase_06 AC 358 ms
96,404 KB
testcase_07 AC 308 ms
96,604 KB
testcase_08 AC 267 ms
97,052 KB
testcase_09 AC 218 ms
96,680 KB
testcase_10 AC 345 ms
96,668 KB
testcase_11 AC 194 ms
87,776 KB
testcase_12 AC 261 ms
96,392 KB
testcase_13 AC 365 ms
96,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K = map(int,raw_input().split())
M = [[0]*1010 for i in xrange(1010)]
for loop in xrange(N):
    x,y,hp = map(int,raw_input().split())
    x += 500; y += 500
    M[y][x] = hp

A = [[0]*1010 for i in xrange(1010)]
for loop in xrange(K):
    ax,ay,w,h,d = map(int,raw_input().split())
    ax += 500; ay += 500
    ex,ey = min(1009,ax+w+1), min(1009,ay+h+1)
    A[ay][ax] += d
    A[ay][ex] -= d
    A[ey][ax] -= d
    A[ey][ex] += d
        
ans = 0
for x in xrange(1010):
    for y in xrange(1,1010):
        A[y][x] += A[y-1][x]
for y in xrange(1010):
    for x in xrange(1010):
        if x > 0: A[y][x] += A[y][x-1]
        ans += max(0, M[y][x]-A[y][x])
print ans
0