結果

問題 No.60 魔法少女
ユーザー gigurururugigurururu
提出日時 2014-11-09 23:59:43
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,295 ms / 5,000 ms
コード長 382 bytes
コンパイル時間 339 ms
コンパイル使用メモリ 11,488 KB
実行使用メモリ 61,432 KB
最終ジャッジ日時 2023-08-30 02:53:25
合計ジャッジ時間 16,109 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 732 ms
50,868 KB
testcase_01 AC 717 ms
50,828 KB
testcase_02 AC 720 ms
50,760 KB
testcase_03 AC 712 ms
50,952 KB
testcase_04 AC 966 ms
52,660 KB
testcase_05 AC 1,061 ms
61,200 KB
testcase_06 AC 1,254 ms
60,872 KB
testcase_07 AC 1,118 ms
58,496 KB
testcase_08 AC 990 ms
55,272 KB
testcase_09 AC 837 ms
52,364 KB
testcase_10 AC 1,228 ms
61,068 KB
testcase_11 AC 789 ms
52,780 KB
testcase_12 AC 967 ms
58,488 KB
testcase_13 AC 1,295 ms
61,432 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.map!{|i|
  s=0
  a=a.zip(i.map{|j|s+=j}).map{|j,l|j+l}
}

p e.map{|x,y,h|[h-m[y+500][x+500],0].max}.inject(:+)
#require'pp'
#pp m[490..510].map{|i|i[490..510]}
0