結果
問題 | No.79 過小評価ダメ・ゼッタイ |
ユーザー |
![]() |
提出日時 | 2020-01-29 10:49:20 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 150 ms / 5,000 ms |
コード長 | 254 bytes |
コンパイル時間 | 219 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 18,560 KB |
最終ジャッジ日時 | 2024-09-16 00:43:50 |
合計ジャッジ時間 | 4,279 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n Syntax OK
ソースコード
n = gets.chomp.to_i l = gets.chomp.split.map(&:to_i) h = {} l.each do |li| h[li] ||= 0 h[li] += 1 end m_cnt = -1 ans = -1 h.keys.each do |key| if h[key] > m_cnt || (h[key] == m_cnt && ans < key) ans = key m_cnt = h[key] end end puts ans