結果

問題 No.1032 数数え
ユーザー ks2mks2m
提出日時 2020-04-23 13:04:25
言語 Java21
(openjdk 21)
結果
AC  
実行時間 483 ms / 2,000 ms
コード長 662 bytes
コンパイル時間 2,253 ms
コンパイル使用メモリ 77,016 KB
実行使用メモリ 63,072 KB
最終ジャッジ日時 2024-04-21 12:52:10
合計ジャッジ時間 4,387 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
40,704 KB
testcase_01 AC 66 ms
38,784 KB
testcase_02 AC 71 ms
39,232 KB
testcase_03 AC 67 ms
38,964 KB
testcase_04 AC 66 ms
39,124 KB
testcase_05 AC 81 ms
40,832 KB
testcase_06 AC 73 ms
40,704 KB
testcase_07 AC 483 ms
63,072 KB
testcase_08 AC 77 ms
39,012 KB
testcase_09 AC 133 ms
42,196 KB
testcase_10 AC 73 ms
40,516 KB
testcase_11 AC 64 ms
40,756 KB
testcase_12 AC 459 ms
62,540 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		int m = Integer.parseInt(sa[1]);
		sa = br.readLine().split(" ");
		int[] ans = new int[200001];
		for (int i = 0; i < n; i++) {
			int l = Integer.parseInt(sa[i]);
			ans[l]++;
		}
		br.close();

		PrintWriter pw = new PrintWriter(System.out);
		for (int i = 1; i <= m; i++) {
			pw.println(i + " " + ans[i]);
		}
		pw.flush();
	}
}
0