結果

問題 No.60 魔法少女
ユーザー roiti46roiti46
提出日時 2015-02-18 03:10:10
言語 Python2
(2.7.18)
結果
AC  
実行時間 1,849 ms / 5,000 ms
コード長 669 bytes
コンパイル時間 79 ms
コンパイル使用メモリ 6,708 KB
実行使用メモリ 48,812 KB
最終ジャッジ日時 2023-09-06 01:58:06
合計ジャッジ時間 19,830 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 809 ms
22,128 KB
testcase_01 AC 815 ms
22,072 KB
testcase_02 AC 810 ms
22,128 KB
testcase_03 AC 825 ms
27,956 KB
testcase_04 AC 1,439 ms
46,792 KB
testcase_05 AC 1,455 ms
48,580 KB
testcase_06 AC 1,849 ms
48,640 KB
testcase_07 AC 1,600 ms
48,164 KB
testcase_08 AC 1,352 ms
47,680 KB
testcase_09 AC 1,113 ms
46,836 KB
testcase_10 AC 1,764 ms
48,604 KB
testcase_11 AC 951 ms
46,440 KB
testcase_12 AC 1,288 ms
48,232 KB
testcase_13 AC 1,833 ms
48,812 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