結果

問題 No.60 魔法少女
ユーザー 6soukiti296soukiti29
提出日時 2017-08-03 08:34:11
言語 Nim
(2.0.2)
結果
AC  
実行時間 205 ms / 5,000 ms
コード長 725 bytes
コンパイル時間 2,866 ms
コンパイル使用メモリ 68,348 KB
実行使用メモリ 18,884 KB
最終ジャッジ日時 2023-09-12 13:52:00
合計ジャッジ時間 5,992 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
12,832 KB
testcase_01 AC 23 ms
12,812 KB
testcase_02 AC 23 ms
13,048 KB
testcase_03 AC 25 ms
16,944 KB
testcase_04 AC 115 ms
18,744 KB
testcase_05 AC 131 ms
18,748 KB
testcase_06 AC 201 ms
18,720 KB
testcase_07 AC 153 ms
18,680 KB
testcase_08 AC 105 ms
18,852 KB
testcase_09 AC 57 ms
18,752 KB
testcase_10 AC 186 ms
18,748 KB
testcase_11 AC 42 ms
18,884 KB
testcase_12 AC 99 ms
18,712 KB
testcase_13 AC 205 ms
18,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sequtils,strutils
var
    monster : array[-501..501,array[-501..501,int]]
    damage : array[-501..501,array[-501..501,int]]
    N,K : int
    x,y,h,w,d,x2,y2 : int
    ans : int
(N,K) = stdin.readline.split.map(parseInt)
for n in 0..<N:
    (x,y,h) = stdin.readline.split.map(parseInt)
    monster[y][x] = h
    
for k in 0..<K:
    (x,y,w,h,d) = stdin.readline.split.map(parseInt)
    x2 = min(x + w + 1,501)
    y2 = min(y + h + 1,501)
    damage[y][x] += d
    damage[y2][x] -= d
    damage[y][x2] -= d
    damage[y2][x2] += d

for i in -500..500:
    for j in -500..500:
        damage[i][j] += damage[i - 1][j] + damage[i][j - 1] - damage[i - 1][j - 1]
        ans += max(0,monster[i][j] - damage[i][j])
echo ans
0