結果

問題 No.202 1円玉投げ
ユーザー TANIGUCHI KousukeTANIGUCHI Kousuke
提出日時 2015-08-20 13:33:55
言語 Ruby
(3.3.0)
結果
AC  
実行時間 2,380 ms / 5,000 ms
コード長 619 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 11,380 KB
実行使用メモリ 55,060 KB
最終ジャッジ日時 2023-08-23 23:12:57
合計ジャッジ時間 30,706 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,380 ms
54,596 KB
testcase_01 AC 863 ms
45,604 KB
testcase_02 AC 139 ms
28,112 KB
testcase_03 AC 139 ms
28,028 KB
testcase_04 AC 136 ms
28,076 KB
testcase_05 AC 168 ms
32,784 KB
testcase_06 AC 727 ms
38,136 KB
testcase_07 AC 796 ms
38,160 KB
testcase_08 AC 855 ms
45,344 KB
testcase_09 AC 457 ms
38,424 KB
testcase_10 AC 266 ms
37,156 KB
testcase_11 AC 406 ms
38,224 KB
testcase_12 AC 404 ms
38,276 KB
testcase_13 AC 268 ms
37,524 KB
testcase_14 AC 176 ms
33,856 KB
testcase_15 AC 470 ms
38,392 KB
testcase_16 AC 1,798 ms
52,708 KB
testcase_17 AC 1,800 ms
52,640 KB
testcase_18 AC 1,843 ms
52,780 KB
testcase_19 AC 426 ms
38,220 KB
testcase_20 AC 633 ms
38,364 KB
testcase_21 AC 427 ms
38,108 KB
testcase_22 AC 147 ms
28,840 KB
testcase_23 AC 148 ms
28,956 KB
testcase_24 AC 146 ms
28,904 KB
testcase_25 AC 143 ms
28,728 KB
testcase_26 AC 145 ms
28,864 KB
testcase_27 AC 144 ms
28,920 KB
testcase_28 AC 150 ms
28,976 KB
testcase_29 AC 150 ms
28,960 KB
testcase_30 AC 152 ms
28,968 KB
testcase_31 AC 147 ms
28,956 KB
testcase_32 AC 138 ms
28,912 KB
testcase_33 AC 148 ms
29,060 KB
testcase_34 AC 167 ms
31,492 KB
testcase_35 AC 2,313 ms
54,872 KB
testcase_36 AC 2,378 ms
54,788 KB
testcase_37 AC 906 ms
46,060 KB
testcase_38 AC 2,329 ms
55,060 KB
testcase_39 AC 134 ms
28,344 KB
testcase_40 AC 135 ms
28,416 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

# Here your code !
MAX = 20000
CELL = 40
SEG = MAX.div(CELL) + 3
ZONE = SEG.times.map { SEG.times.map { [] } }

n = gets.to_i
coins = n.times.map { gets.split.map(&:to_i) }


puts coins.inject(0) {|s,c|
    cx, cy = c.map {|v| v / CELL + 1}
    nears = [cx - 1, cx, cx + 1].product([cy - 1, cy, cy + 1])
    intersect = nears.all? do |dx,dy|
        begin
        ZONE[dx][dy].empty? || ZONE[dx][dy].all? { |v| 2.times.inject(0) {|q,i| q + (c[i] - v[i]) ** 2} >= 400  }
        rescue
            p [dx,dy]
        end
    end

    unless intersect
        s
    else
        ZONE[cx][cy].push(c)
        s+1
    end
}
0