結果

問題 No.60 魔法少女
ユーザー gigurururugigurururu
提出日時 2014-11-10 00:12:45
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 469 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 11,336 KB
実行使用メモリ 70,116 KB
最終ジャッジ日時 2023-08-30 02:56:35
合計ジャッジ時間 12,732 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,268 KB
testcase_01 AC 81 ms
15,176 KB
testcase_02 AC 86 ms
15,056 KB
testcase_03 AC 474 ms
32,972 KB
testcase_04 AC 1,047 ms
58,912 KB
testcase_05 AC 1,071 ms
63,020 KB
testcase_06 AC 1,360 ms
68,800 KB
testcase_07 AC 1,170 ms
63,684 KB
testcase_08 AC 989 ms
58,128 KB
testcase_09 AC 800 ms
54,164 KB
testcase_10 AC 1,304 ms
68,136 KB
testcase_11 WA -
testcase_12 AC 952 ms
59,152 KB
testcase_13 AC 1,353 ms
70,116 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def g;gets.split.map(&:to_i);end
n,k=g
e=(1..n).map{g}
t=(1..k).map{g}
xn=t.map{|x,_|x}.min
xx=t.map{|x,y,w,_|x+w}.max
yn=t.map{|x,y,_|y}.min
yx=t.map{|x,y,w,h,_|y+h}.max

m=(yn..yx+1).map{[0]*(xx-xn+1+1)}

t.each{|x,y,w,h,d|
  x-=xn;y-=yn
  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]*(xx-xn+1)
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-yn]||[])[x-xn]||0,0].max}.inject(:+)
0