結果

問題 No.60 魔法少女
ユーザー gigurururugigurururu
提出日時 2014-11-09 23:53:32
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,304 ms / 5,000 ms
コード長 332 bytes
コンパイル時間 74 ms
コンパイル使用メモリ 11,336 KB
実行使用メモリ 61,464 KB
最終ジャッジ日時 2023-08-30 02:53:05
合計ジャッジ時間 15,235 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 726 ms
50,972 KB
testcase_01 AC 725 ms
50,864 KB
testcase_02 AC 716 ms
50,872 KB
testcase_03 AC 720 ms
51,008 KB
testcase_04 AC 992 ms
52,688 KB
testcase_05 AC 1,071 ms
61,160 KB
testcase_06 AC 1,260 ms
61,076 KB
testcase_07 AC 1,117 ms
58,560 KB
testcase_08 AC 986 ms
55,432 KB
testcase_09 AC 839 ms
52,064 KB
testcase_10 AC 1,237 ms
60,984 KB
testcase_11 AC 774 ms
53,020 KB
testcase_12 AC 974 ms
58,532 KB
testcase_13 AC 1,304 ms
61,464 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def g;gets.split.map(&:to_i);end
n,k=g
e=(1..n).map{g}
m=(1..1502).map{[0]*1502}
k.times{
  x,y,w,h,d=g
  x+=500;y+=500
  m[y][x]+=d
  m[y][x+w+1]-=d
  m[y+h+1][x]-=d
  m[y+h+1][x+w+1]+=d
}
a=[0]*1502
m=m.map{|i|
  s=0
  a=a.zip(i.map{|j|s+=j}).map{|j,k|j+k}
}

p e.map{|x,y,h|[h-m[y+500][x+500],0].max}.inject(:+)
0