結果

問題 No.2092 Conjugation
ユーザー tentententen
提出日時 2022-10-11 09:36:09
言語 Java21
(openjdk 21)
結果
AC  
実行時間 244 ms / 2,000 ms
コード長 1,445 bytes
コンパイル時間 4,161 ms
コンパイル使用メモリ 73,972 KB
実行使用メモリ 56,380 KB
最終ジャッジ日時 2023-09-07 11:13:53
合計ジャッジ時間 9,750 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
49,212 KB
testcase_01 AC 41 ms
49,724 KB
testcase_02 AC 43 ms
49,512 KB
testcase_03 AC 44 ms
49,280 KB
testcase_04 AC 43 ms
47,356 KB
testcase_05 AC 43 ms
49,320 KB
testcase_06 AC 43 ms
49,324 KB
testcase_07 AC 89 ms
51,860 KB
testcase_08 AC 188 ms
55,720 KB
testcase_09 AC 177 ms
56,100 KB
testcase_10 AC 187 ms
56,252 KB
testcase_11 AC 195 ms
56,276 KB
testcase_12 AC 175 ms
55,856 KB
testcase_13 AC 131 ms
54,240 KB
testcase_14 AC 141 ms
54,076 KB
testcase_15 AC 170 ms
54,776 KB
testcase_16 AC 237 ms
56,212 KB
testcase_17 AC 224 ms
56,380 KB
testcase_18 AC 244 ms
56,232 KB
testcase_19 AC 151 ms
56,120 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        int a1 = sc.nextInt();
        int[] sums = new int[a1 + 1];
        sums[0] = 1;
        for (int i = 0; i < n - 1; i++) {
            sums[0]++;
            sums[sc.nextInt()]--;
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < a1; i++) {
            if (i == 0) {
                sb.append(sums[i]);
            } else {
                sums[i] += sums[i - 1];
                sb.append(" ").append(sums[i]);
            }
        }
        System.out.println(sb);
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0