結果
問題 |
No.202 1円玉投げ
|
ユーザー |
![]() |
提出日時 | 2015-08-19 13:08:50 |
言語 | Ruby (3.4.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 553 bytes |
コンパイル時間 | 206 ms |
コンパイル使用メモリ | 7,680 KB |
実行使用メモリ | 40,832 KB |
最終ジャッジ日時 | 2024-12-22 09:57:14 |
合計ジャッジ時間 | 43,610 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 RE * 21 TLE * 5 |
コンパイルメッセージ
Syntax OK
ソースコード
# Here your code ! def d2(a,b) 2.times.inject(0) do |s, i| s + (a[i] - b[i]) ** 2 end end n = gets.to_i coins = n.times.map {gets.split.map(&:to_i)} areas = 202.times.map { Array.new(202) } s = coins.inject(0) {|s,c| i,j = c.map {|v| v.div(100) + 1} insec = (i-1..i+1).each.all? { |di| (j-1..j+1).each.all? { |dj| areas[di][dj] ||= [] areas[di][dj].all? {|put| d2(put,c) >= 400} } } if insec areas[i][j].push(c) s+1 else s end } puts s