結果

問題 No.365 ジェンガソート
ユーザー ki_ki33ki_ki33
提出日時 2016-04-29 22:33:43
言語 Java21
(openjdk 21)
結果
AC  
実行時間 537 ms / 2,000 ms
コード長 691 bytes
コンパイル時間 1,834 ms
コンパイル使用メモリ 74,040 KB
実行使用メモリ 59,696 KB
最終ジャッジ日時 2024-04-20 06:32:15
合計ジャッジ時間 16,570 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
53,420 KB
testcase_01 AC 110 ms
52,704 KB
testcase_02 AC 105 ms
53,040 KB
testcase_03 AC 125 ms
54,120 KB
testcase_04 AC 109 ms
53,044 KB
testcase_05 AC 121 ms
54,036 KB
testcase_06 AC 103 ms
53,036 KB
testcase_07 AC 109 ms
52,944 KB
testcase_08 AC 122 ms
54,040 KB
testcase_09 AC 107 ms
53,072 KB
testcase_10 AC 113 ms
53,036 KB
testcase_11 AC 112 ms
53,224 KB
testcase_12 AC 119 ms
54,108 KB
testcase_13 AC 108 ms
52,852 KB
testcase_14 AC 116 ms
54,012 KB
testcase_15 AC 123 ms
54,104 KB
testcase_16 AC 501 ms
59,304 KB
testcase_17 AC 488 ms
59,696 KB
testcase_18 AC 209 ms
57,632 KB
testcase_19 AC 465 ms
59,032 KB
testcase_20 AC 360 ms
59,004 KB
testcase_21 AC 295 ms
57,888 KB
testcase_22 AC 447 ms
59,412 KB
testcase_23 AC 428 ms
59,480 KB
testcase_24 AC 431 ms
59,156 KB
testcase_25 AC 302 ms
59,056 KB
testcase_26 AC 449 ms
59,232 KB
testcase_27 AC 531 ms
59,312 KB
testcase_28 AC 473 ms
59,124 KB
testcase_29 AC 519 ms
59,232 KB
testcase_30 AC 444 ms
59,324 KB
testcase_31 AC 311 ms
59,136 KB
testcase_32 AC 313 ms
57,788 KB
testcase_33 AC 537 ms
59,288 KB
testcase_34 AC 271 ms
58,672 KB
testcase_35 AC 492 ms
59,552 KB
testcase_36 AC 454 ms
57,960 KB
testcase_37 AC 468 ms
58,780 KB
testcase_38 AC 496 ms
59,224 KB
testcase_39 AC 501 ms
59,540 KB
testcase_40 AC 500 ms
58,164 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedInputStream;
import java.util.Scanner;
public class Main {
	static final long C =  1000000007;
	static final int CY = 1000000000;
	StringBuilder sb;

	public void calc() {
		sb = new StringBuilder();
		BufferedInputStream bs = new BufferedInputStream(System.in);

		Scanner sc = new Scanner(bs);

		int n = sc.nextInt();

		int[] a = new int[n];
		for (int i=0; i < n; i++) {
			a[i] = sc.nextInt();
		}


		long ans = 0;
		int bef = n+1;
		for (int i=n-1; i >= 0; i--) {
			if (bef-1 != a[i]) {
				ans++;
			}else {
				bef = a[i];
			}
		}




		System.out.println(ans);
	}

	public static void main(String[] args) {
		Main main = new Main();
		main.calc();

	}
}
0