結果

問題 No.202 1円玉投げ
ユーザー TANIGUCHI Kousuke
提出日時 2015-08-19 12:43:07
言語 Ruby
(3.4.1)
結果
TLE  
実行時間 -
コード長 416 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 43,904 KB
最終ジャッジ日時 2024-12-22 09:58:17
合計ジャッジ時間 59,013 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 WA * 19 TLE * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

# 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 = 200.times.map { Array.new(200) }

s = coins.inject(0) {|s,c|
    i,j = c.map {|v| v.div 200}
    areas[i][j] ||= []
    if areas[i][j].all? {|put| d2(put,c) >= 400}
        areas[i][j].push(c)
        s+1
    else
        s
    end
}

puts s
0