結果

問題 No.60 魔法少女
ユーザー TawaraTawara
提出日時 2015-12-12 23:29:27
言語 Python2
(2.7.18)
結果
AC  
実行時間 1,525 ms / 5,000 ms
コード長 561 bytes
コンパイル時間 686 ms
コンパイル使用メモリ 6,684 KB
実行使用メモリ 55,612 KB
最終ジャッジ日時 2023-10-13 11:55:18
合計ジャッジ時間 15,409 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 410 ms
13,836 KB
testcase_01 AC 411 ms
13,812 KB
testcase_02 AC 408 ms
13,708 KB
testcase_03 AC 426 ms
20,000 KB
testcase_04 AC 1,054 ms
40,724 KB
testcase_05 AC 1,119 ms
54,508 KB
testcase_06 AC 1,509 ms
54,228 KB
testcase_07 AC 1,239 ms
49,772 KB
testcase_08 AC 963 ms
47,624 KB
testcase_09 AC 718 ms
41,396 KB
testcase_10 AC 1,465 ms
54,380 KB
testcase_11 AC 576 ms
41,204 KB
testcase_12 AC 923 ms
49,820 KB
testcase_13 AC 1,525 ms
55,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ADD = 500; UB = ADD*2+1
N,K=map(int,raw_input().split())
field = [[0]*(UB+1) for i in xrange(UB+1)]
enemy = [map(int,raw_input().split()) for i in xrange(N)]
for i in xrange(K):
	x,y,w,h,d = map(int,raw_input().split())
	x += ADD; y += ADD
	r = min(UB,x+w+1);t = min(UB,y+h+1)
	field[y][x] += d; field[y][r] -= d
	field[t][x] -= d; field[t][r] += d
for h in xrange(UB+1):
	for w in xrange(UB):
		field[h][w+1] += field[h][w]
for w in xrange(UB+1):
	for h in xrange(UB):
		field[h+1][w] += field[h][w]
print sum(max(0,hp-field[y+ADD][x+ADD]) for x,y,hp in enemy)
0