結果

問題 No.29 パワーアップ
ユーザー TANIGUCHI KousukeTANIGUCHI Kousuke
提出日時 2015-05-14 13:00:29
言語 Ruby
(3.1.1p18 )
結果
AC  
実行時間 74 ms / 5,000 ms
コード長 306 bytes
コンパイル時間 31 ms
使用メモリ 13,984 KB
最終ジャッジ日時 2023-02-08 15:47:32
合計ジャッジ時間 2,945 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 74 ms
13,848 KB
testcase_01 AC 72 ms
13,976 KB
testcase_02 AC 73 ms
13,812 KB
testcase_03 AC 73 ms
13,932 KB
testcase_04 AC 73 ms
13,916 KB
testcase_05 AC 72 ms
13,800 KB
testcase_06 AC 73 ms
13,720 KB
testcase_07 AC 73 ms
13,744 KB
testcase_08 AC 73 ms
13,936 KB
testcase_09 AC 73 ms
13,896 KB
testcase_10 AC 72 ms
13,836 KB
testcase_11 AC 73 ms
13,688 KB
testcase_12 AC 72 ms
13,940 KB
testcase_13 AC 72 ms
13,720 KB
testcase_14 AC 73 ms
13,752 KB
testcase_15 AC 72 ms
13,804 KB
testcase_16 AC 72 ms
13,836 KB
testcase_17 AC 73 ms
13,984 KB
testcase_18 AC 72 ms
13,820 KB
testcase_19 AC 71 ms
13,912 KB
testcase_20 AC 72 ms
13,940 KB
testcase_21 AC 72 ms
13,804 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
items = n.times.each_with_object(Hash.new(0)) { |j,o|
    gets.chomp.split.map(&:to_i).each {|i|
        o[i] += 1
    }
}
dup_up = items.keys.inject(0) { |s,v|
    count = items[v]
    items[v] = count % 2
    s += count / 2
}
tetra_up = items.values.inject(0,&:+) / 4
puts dup_up + tetra_up
0