結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー siman
提出日時 2015-01-10 22:55:11
言語 Ruby
(3.4.1)
結果
AC  
実行時間 145 ms / 5,000 ms
コード長 237 bytes
コンパイル時間 49 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 20,480 KB
最終ジャッジ日時 2024-06-26 07:26:36
合計ジャッジ時間 3,600 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:3: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

class A
  def initialize
    n = gets.chomp.to_i
    l = gets.chomp.split(' ').map(&:to_i)

    cache = Hash.new(false)

    p l.group_by{|i| cache[i] || cache[i] = l.count(i)}.sort.reverse.to_h.first.last.uniq.sort.last
  end
end

A.new
0