結果

問題 No.202 1円玉投げ
ユーザー TANIGUCHI KousukeTANIGUCHI Kousuke
提出日時 2015-08-19 12:41:06
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 416 bytes
コンパイル時間 340 ms
コンパイル使用メモリ 11,292 KB
実行使用メモリ 26,328 KB
最終ジャッジ日時 2023-08-23 23:10:22
合計ジャッジ時間 30,686 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 AC 82 ms
15,116 KB
testcase_03 AC 82 ms
15,064 KB
testcase_04 AC 82 ms
15,276 KB
testcase_05 RE -
testcase_06 WA -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 WA -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 WA -
testcase_15 RE -
testcase_16 AC 3,746 ms
25,996 KB
testcase_17 AC 3,756 ms
26,040 KB
testcase_18 AC 3,772 ms
26,072 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 90 ms
15,376 KB
testcase_23 RE -
testcase_24 AC 94 ms
15,324 KB
testcase_25 RE -
testcase_26 AC 89 ms
15,216 KB
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 AC 89 ms
15,108 KB
testcase_32 AC 85 ms
15,152 KB
testcase_33 RE -
testcase_34 AC 128 ms
15,392 KB
testcase_35 TLE -
testcase_36 RE -
testcase_37 RE -
testcase_38 TLE -
testcase_39 AC 86 ms
15,236 KB
testcase_40 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 = 100.times.map { Array.new(100) }

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