結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 815 ms
22,052 KB
testcase_01 AC 815 ms
22,136 KB
testcase_02 AC 814 ms
21,964 KB
testcase_03 AC 830 ms
28,104 KB
testcase_04 AC 1,478 ms
47,060 KB
testcase_05 AC 1,490 ms
48,660 KB
testcase_06 AC 1,866 ms
48,704 KB
testcase_07 WA -
testcase_08 AC 1,370 ms
47,928 KB
testcase_09 AC 1,131 ms
46,940 KB
testcase_10 AC 1,801 ms
48,824 KB
testcase_11 WA -
testcase_12 AC 1,310 ms
48,164 KB
testcase_13 AC 1,886 ms
48,856 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+2), min(1009,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(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