結果

問題 No.3039 配信者
ユーザー ks2m
提出日時 2025-02-28 21:36:03
言語 Java
(openjdk 23)
結果
AC  
実行時間 730 ms / 2,000 ms
コード長 682 bytes
コンパイル時間 3,141 ms
コンパイル使用メモリ 76,104 KB
実行使用メモリ 62,704 KB
最終ジャッジ日時 2025-02-28 21:36:17
合計ジャッジ時間 11,518 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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 h = Integer.parseInt(sa[1]);
		int[] c = new int[h + 1];
		for (int i = 0; i < n; i++) {
			sa = br.readLine().split(" ");
			int a = Integer.parseInt(sa[0]);
			int b = Integer.parseInt(sa[1]) + 1;
			c[a]++;
			c[b]--;
		}
		br.close();

		int ans = c[0];
		for (int i = 1; i <= h; i++) {
			c[i] += c[i - 1];
			ans = Math.max(ans, c[i]);
		}
		System.out.println(ans);
	}
}
0