結果

問題 No.60 魔法少女
ユーザー roiti46roiti46
提出日時 2015-02-18 03:06:38
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 669 bytes
コンパイル時間 61 ms
コンパイル使用メモリ 6,660 KB
実行使用メモリ 48,304 KB
最終ジャッジ日時 2023-09-06 01:57:00
合計ジャッジ時間 19,955 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 798 ms
21,760 KB
testcase_01 AC 800 ms
21,776 KB
testcase_02 AC 799 ms
21,752 KB
testcase_03 AC 803 ms
27,680 KB
testcase_04 AC 1,437 ms
46,224 KB
testcase_05 AC 1,469 ms
47,984 KB
testcase_06 AC 1,850 ms
47,944 KB
testcase_07 WA -
testcase_08 AC 1,354 ms
47,068 KB
testcase_09 AC 1,119 ms
46,300 KB
testcase_10 AC 1,795 ms
47,988 KB
testcase_11 WA -
testcase_12 AC 1,303 ms
47,340 KB
testcase_13 AC 1,882 ms
48,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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