結果

問題 No.1032 数数え
ユーザー yomo3yomo3
提出日時 2020-05-07 23:31:21
言語 Java21
(openjdk 21)
結果
AC  
実行時間 852 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 2,302 ms
コンパイル使用メモリ 74,460 KB
実行使用メモリ 68,212 KB
最終ジャッジ日時 2023-09-16 08:11:21
合計ジャッジ時間 6,779 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 153 ms
55,192 KB
testcase_01 AC 155 ms
57,064 KB
testcase_02 AC 154 ms
56,744 KB
testcase_03 AC 152 ms
56,624 KB
testcase_04 AC 153 ms
56,916 KB
testcase_05 AC 154 ms
56,788 KB
testcase_06 AC 154 ms
56,768 KB
testcase_07 AC 852 ms
68,212 KB
testcase_08 AC 161 ms
56,852 KB
testcase_09 AC 257 ms
59,620 KB
testcase_10 AC 207 ms
59,296 KB
testcase_11 AC 152 ms
57,012 KB
testcase_12 AC 833 ms
67,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.PrintWriter;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] cnt = new int[200001];
        for (int i = 0; i < N; i++) {
            cnt[Integer.parseInt(sc.next())]++;
        }
        for (int i = 1; i <= M; i++) {
            pw.println(i + " " + cnt[i]);
        }
        pw.flush();
    }
}
0