結果

問題 No.29 パワーアップ
ユーザー apierceapierce
提出日時 2022-11-03 15:07:31
言語 Ruby
(3.3.0)
結果
AC  
実行時間 82 ms / 5,000 ms
コード長 260 bytes
コンパイル時間 57 ms
コンパイル使用メモリ 11,488 KB
実行使用メモリ 15,324 KB
最終ジャッジ日時 2023-09-25 00:14:13
合計ジャッジ時間 2,924 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
15,268 KB
testcase_01 AC 82 ms
15,324 KB
testcase_02 AC 80 ms
15,300 KB
testcase_03 AC 79 ms
15,144 KB
testcase_04 AC 80 ms
15,040 KB
testcase_05 AC 80 ms
15,036 KB
testcase_06 AC 78 ms
15,084 KB
testcase_07 AC 80 ms
15,144 KB
testcase_08 AC 78 ms
15,256 KB
testcase_09 AC 79 ms
15,260 KB
testcase_10 AC 78 ms
15,152 KB
testcase_11 AC 79 ms
15,268 KB
testcase_12 AC 78 ms
15,236 KB
testcase_13 AC 80 ms
15,264 KB
testcase_14 AC 79 ms
15,320 KB
testcase_15 AC 80 ms
15,324 KB
testcase_16 AC 78 ms
15,084 KB
testcase_17 AC 78 ms
15,084 KB
testcase_18 AC 79 ms
15,168 KB
testcase_19 AC 79 ms
15,032 KB
testcase_20 AC 79 ms
15,264 KB
testcase_21 AC 79 ms
15,296 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n = gets.to_i
arr = Array.new(11, 0)
ans = 0

n.times do |i|
    a, b, c = gets.split.map(&:to_i)
    arr[a] += 1
    arr[b] += 1
    arr[c] += 1
end

10.times do |j|
    j += 1
    x, y = arr[j].divmod(2)
    ans += x
    arr[j] = y
end
puts ans + arr.sum / 4
0