結果

問題 No.2154 あさかつの参加人数
ユーザー KowerKoint2010KowerKoint2010
提出日時 2022-11-24 23:40:47
言語 Java19
(openjdk 21)
結果
AC  
実行時間 833 ms / 2,000 ms
コード長 952 bytes
コンパイル時間 2,227 ms
コンパイル使用メモリ 74,464 KB
実行使用メモリ 69,124 KB
最終ジャッジ日時 2023-07-24 16:50:21
合計ジャッジ時間 23,802 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 810 ms
67,796 KB
testcase_01 AC 833 ms
67,644 KB
testcase_02 AC 827 ms
65,856 KB
testcase_03 AC 827 ms
68,752 KB
testcase_04 AC 820 ms
68,044 KB
testcase_05 AC 481 ms
57,400 KB
testcase_06 AC 730 ms
61,152 KB
testcase_07 AC 638 ms
65,736 KB
testcase_08 AC 656 ms
66,008 KB
testcase_09 AC 391 ms
64,904 KB
testcase_10 AC 632 ms
65,412 KB
testcase_11 AC 783 ms
69,124 KB
testcase_12 AC 681 ms
66,148 KB
testcase_13 AC 539 ms
59,192 KB
testcase_14 AC 705 ms
62,788 KB
testcase_15 AC 659 ms
64,192 KB
testcase_16 AC 743 ms
55,348 KB
testcase_17 AC 716 ms
54,332 KB
testcase_18 AC 755 ms
56,944 KB
testcase_19 AC 231 ms
48,588 KB
testcase_20 AC 736 ms
57,740 KB
testcase_21 AC 336 ms
49,972 KB
testcase_22 AC 525 ms
60,120 KB
testcase_23 AC 740 ms
57,528 KB
testcase_24 AC 803 ms
59,368 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