結果

問題 No.2154 あさかつの参加人数
ユーザー viral8viral8
提出日時 2022-12-09 21:48:00
言語 Java21
(openjdk 21)
結果
AC  
実行時間 658 ms / 2,000 ms
コード長 732 bytes
コンパイル時間 2,229 ms
コンパイル使用メモリ 74,628 KB
実行使用メモリ 54,200 KB
最終ジャッジ日時 2024-04-22 21:40:14
合計ジャッジ時間 20,549 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 645 ms
53,160 KB
testcase_01 AC 646 ms
54,088 KB
testcase_02 AC 630 ms
54,200 KB
testcase_03 AC 643 ms
53,460 KB
testcase_04 AC 642 ms
53,424 KB
testcase_05 AC 484 ms
45,928 KB
testcase_06 AC 581 ms
50,064 KB
testcase_07 AC 559 ms
50,236 KB
testcase_08 AC 552 ms
50,952 KB
testcase_09 AC 265 ms
46,120 KB
testcase_10 AC 523 ms
50,472 KB
testcase_11 AC 620 ms
52,952 KB
testcase_12 AC 568 ms
50,652 KB
testcase_13 AC 495 ms
46,176 KB
testcase_14 AC 581 ms
50,404 KB
testcase_15 AC 533 ms
50,696 KB
testcase_16 AC 591 ms
50,148 KB
testcase_17 AC 596 ms
50,588 KB
testcase_18 AC 603 ms
53,364 KB
testcase_19 AC 201 ms
43,640 KB
testcase_20 AC 581 ms
53,576 KB
testcase_21 AC 237 ms
46,088 KB
testcase_22 AC 313 ms
48,444 KB
testcase_23 AC 625 ms
52,792 KB
testcase_24 AC 658 ms
53,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
class Main{
	public static void main(String[] args)throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] str = br.readLine().split(" ");
		int N = Integer.parseInt(str[0]);
		int M = Integer.parseInt(str[1]);
		int[] sum = new int[N];
		while(M-->0){
			str = br.readLine().split(" ");
			int L = Integer.parseInt(str[0]);
			sum[N-L]++;
			int R = Integer.parseInt(str[1]);
			if(R>1)
				sum[N-R+1]--;
		}
		int now = 0;
		StringBuilder ans = new StringBuilder();
		for(int sub:sum){
			now += sub;
			ans.append(now);
			ans.append('\n');
		}
		System.out.print(ans.toString());
	}
}
0