結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー gemmarogemmaro
提出日時 2019-10-25 20:00:42
言語 Ruby
(3.3.0)
結果
AC  
実行時間 137 ms / 5,000 ms
コード長 493 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 11,532 KB
実行使用メモリ 22,704 KB
最終ジャッジ日時 2023-09-29 01:26:42
合計ジャッジ時間 4,173 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
15,148 KB
testcase_01 AC 135 ms
22,352 KB
testcase_02 AC 85 ms
15,288 KB
testcase_03 AC 81 ms
15,052 KB
testcase_04 AC 83 ms
15,052 KB
testcase_05 AC 136 ms
22,504 KB
testcase_06 AC 80 ms
15,148 KB
testcase_07 AC 81 ms
15,328 KB
testcase_08 AC 84 ms
15,080 KB
testcase_09 AC 83 ms
15,056 KB
testcase_10 AC 84 ms
15,292 KB
testcase_11 AC 82 ms
15,320 KB
testcase_12 AC 83 ms
15,324 KB
testcase_13 AC 81 ms
15,164 KB
testcase_14 AC 112 ms
19,084 KB
testcase_15 AC 93 ms
16,516 KB
testcase_16 AC 119 ms
20,456 KB
testcase_17 AC 95 ms
16,380 KB
testcase_18 AC 117 ms
20,356 KB
testcase_19 AC 111 ms
18,944 KB
testcase_20 AC 137 ms
22,704 KB
testcase_21 AC 84 ms
15,052 KB
testcase_22 AC 102 ms
17,496 KB
testcase_23 AC 134 ms
21,832 KB
testcase_24 AC 135 ms
22,212 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n
Main.rb:6: warning: assigned but unused variable - max_key
Syntax OK

ソースコード

diff #

n = gets.chomp.to_i

l_s = gets.chomp.split.map &:to_i

extracts = {}
max_key = 0
max_value = 0
l_s.group_by{|i|i}.each{|key, value|
    if value.size >= max_value
        max_value = value.size
        extracts[key] = value.size
    end
}

max_num = 0
extracts.each {|level, num|
    if num >= max_num
        max_num = num
    end
}

max_level = 0
extracts.each {|level, num|
    if num == max_num
        if level > max_level
            max_level = level
        end
    end
}

p max_level
0