結果
| 問題 |
No.1390 Get together
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-23 03:47:16 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 386 bytes |
| コンパイル時間 | 198 ms |
| コンパイル使用メモリ | 7,680 KB |
| 実行使用メモリ | 45,568 KB |
| 最終ジャッジ日時 | 2024-11-24 18:35:35 |
| 合計ジャッジ時間 | 16,314 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 15 |
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - m Syntax OK
ソースコード
n, m = gets.chomp.split(" ").map(&:to_i)
arr = n.times.map{gets.chomp.split(" ").map(&:to_i)}
hash = Hash.new { |i,j| hash[j] = [] }
arr.each do |x,y|
hash[y] << x
end
ans = 0
hash.each do |color,box|
hash_count = Hash.new(0)
box.each do |i|
hash_count[i] += 1
end
an = hash_count.sort_by{|a,b| b}
many = an.pop
ans += (box.size-many[1])
end
puts ans