結果

問題 No.1032 数数え
ユーザー 山根直也山根直也
提出日時 2020-05-13 00:03:30
言語 Ruby
(3.3.0)
結果
AC  
実行時間 520 ms / 2,000 ms
コード長 231 bytes
コンパイル時間 434 ms
コンパイル使用メモリ 11,176 KB
実行使用メモリ 42,888 KB
最終ジャッジ日時 2023-10-12 03:56:19
合計ジャッジ時間 3,101 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
15,040 KB
testcase_01 AC 84 ms
15,192 KB
testcase_02 AC 83 ms
15,060 KB
testcase_03 AC 82 ms
15,036 KB
testcase_04 AC 81 ms
15,036 KB
testcase_05 AC 83 ms
15,184 KB
testcase_06 AC 82 ms
15,100 KB
testcase_07 AC 520 ms
42,888 KB
testcase_08 AC 81 ms
15,188 KB
testcase_09 AC 88 ms
15,276 KB
testcase_10 AC 81 ms
14,968 KB
testcase_11 AC 78 ms
15,176 KB
testcase_12 AC 330 ms
32,996 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

s=gets.chomp.split(" ")
num=s[1].to_i

ary=gets.chomp.split(" ")
ary.map!{|x|x.to_i}

ary=ary.group_by(&:itself)
(1..num).each do |n|
    if ary[n]==nil
        puts "#{n} 0"
    else
        puts "#{n} #{ary[n].count}"
    end
end
0