結果

問題 No.29 パワーアップ
コンテスト
ユーザー gemmaro
提出日時 2020-03-23 12:49:00
言語 Crystal
(1.19.1)
コンパイル:
crystal build -Donline_judge -o a.out --release --no-debug _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 352 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 10,819 ms
コンパイル使用メモリ 340,784 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-07-15 22:28:25
合計ジャッジ時間 12,279 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n = (gets || "").chomp.to_i

items = {} of Int32 => Int32
n.times do
  a, b, c = (gets || "").chomp.split.map { |i| i.to_i }
  items[a] ||= 0
  items[b] ||= 0
  items[c] ||= 0
  items[a] += 1
  items[b] += 1
  items[c] += 1
end

power_up = 0
remain = 0
items.each do |_, value|
  power_up += value / 2
  remain += value % 2
end

p power_up + remain / 4
0