結果

問題 No.2092 Conjugation
ユーザー ks2mks2m
提出日時 2022-10-07 21:45:29
言語 Java21
(openjdk 21)
結果
AC  
実行時間 249 ms / 2,000 ms
コード長 733 bytes
コンパイル時間 2,221 ms
コンパイル使用メモリ 72,652 KB
実行使用メモリ 64,224 KB
最終ジャッジ日時 2023-09-03 01:14:27
合計ジャッジ時間 6,295 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
49,232 KB
testcase_01 AC 45 ms
49,276 KB
testcase_02 AC 45 ms
49,088 KB
testcase_03 AC 44 ms
49,672 KB
testcase_04 AC 43 ms
49,076 KB
testcase_05 AC 44 ms
49,436 KB
testcase_06 AC 44 ms
49,248 KB
testcase_07 AC 95 ms
52,160 KB
testcase_08 AC 221 ms
58,492 KB
testcase_09 AC 165 ms
55,132 KB
testcase_10 AC 172 ms
55,200 KB
testcase_11 AC 177 ms
55,832 KB
testcase_12 AC 167 ms
55,904 KB
testcase_13 AC 132 ms
54,504 KB
testcase_14 AC 131 ms
54,768 KB
testcase_15 AC 167 ms
56,496 KB
testcase_16 AC 239 ms
59,968 KB
testcase_17 AC 248 ms
64,224 KB
testcase_18 AC 249 ms
62,720 KB
testcase_19 AC 149 ms
58,036 KB
権限があれば一括ダウンロードができます

ソースコード

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

		int[] b = new int[a[0]];
		int idx = 0;
		for (int i = n - 1; i >= 0; i--) {
			while (idx < a[i]) {
				b[idx] = i + 1;
				idx++;
			}
		}

		StringBuilder sb = new StringBuilder();
		for (int i : b) {
			sb.append(i).append(' ');
		}
		sb.deleteCharAt(sb.length() - 1);
		System.out.println(sb.toString());
	}
}
0