結果

問題 No.2154 あさかつの参加人数
ユーザー KowerKoint2010KowerKoint2010
提出日時 2022-11-24 23:40:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,024 ms / 2,000 ms
コード長 952 bytes
コンパイル時間 2,520 ms
コンパイル使用メモリ 77,732 KB
実行使用メモリ 71,232 KB
最終ジャッジ日時 2024-04-08 20:50:06
合計ジャッジ時間 27,070 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,024 ms
70,820 KB
testcase_01 AC 1,013 ms
71,232 KB
testcase_02 AC 890 ms
70,668 KB
testcase_03 AC 912 ms
70,820 KB
testcase_04 AC 912 ms
70,820 KB
testcase_05 AC 536 ms
61,712 KB
testcase_06 AC 762 ms
64,752 KB
testcase_07 AC 736 ms
69,340 KB
testcase_08 AC 732 ms
70,140 KB
testcase_09 AC 405 ms
69,616 KB
testcase_10 AC 771 ms
67,452 KB
testcase_11 AC 889 ms
71,084 KB
testcase_12 AC 690 ms
69,780 KB
testcase_13 AC 606 ms
65,820 KB
testcase_14 AC 793 ms
67,020 KB
testcase_15 AC 698 ms
70,160 KB
testcase_16 AC 733 ms
69,128 KB
testcase_17 AC 891 ms
66,840 KB
testcase_18 AC 842 ms
68,856 KB
testcase_19 AC 243 ms
60,216 KB
testcase_20 AC 910 ms
69,132 KB
testcase_21 AC 445 ms
69,100 KB
testcase_22 AC 557 ms
71,020 KB
testcase_23 AC 840 ms
69,804 KB
testcase_24 AC 880 ms
69,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class Main{
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] nm = br.readLine().split(" ");
        int n = Integer.parseInt(nm[0]);
        int m = Integer.parseInt(nm[1]);
        ArrayList<Integer> imos=new ArrayList<Integer>();
        for(int i=0;i<n+1;i++)imos.add(0);
        for(int i=0;i<m;i++){
            String[] lr = br.readLine().split(" ");
            int l = Integer.parseInt(lr[0]);
            int r = Integer.parseInt(lr[1]);
            imos.set(n-l,imos.get(n-l)+1);
            imos.set(n-r+1,imos.get(n-r+1)-1);
        }
        br.close();
        PrintWriter pr = new PrintWriter(System.out);
        for(int i=0;i<n;i++){
            imos.set(i+1,imos.get(i+1)+imos.get(i));
            pr.println(imos.get(i));
        }
        pr.flush();
        pr.close();
    }
}
0