結果

問題 No.365 ジェンガソート
ユーザー ki_ki33ki_ki33
提出日時 2016-04-29 22:33:43
言語 Java21
(openjdk 21)
結果
AC  
実行時間 549 ms / 2,000 ms
コード長 691 bytes
コンパイル時間 2,336 ms
コンパイル使用メモリ 71,208 KB
実行使用メモリ 61,540 KB
最終ジャッジ日時 2023-08-02 06:41:13
合計ジャッジ時間 17,336 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,684 KB
testcase_01 AC 129 ms
55,648 KB
testcase_02 AC 122 ms
55,932 KB
testcase_03 AC 122 ms
55,604 KB
testcase_04 AC 128 ms
55,724 KB
testcase_05 AC 126 ms
55,820 KB
testcase_06 AC 123 ms
55,760 KB
testcase_07 AC 127 ms
55,868 KB
testcase_08 AC 123 ms
55,684 KB
testcase_09 AC 126 ms
55,720 KB
testcase_10 AC 122 ms
55,428 KB
testcase_11 AC 122 ms
55,796 KB
testcase_12 AC 123 ms
55,688 KB
testcase_13 AC 135 ms
55,892 KB
testcase_14 AC 129 ms
55,512 KB
testcase_15 AC 139 ms
55,680 KB
testcase_16 AC 505 ms
60,468 KB
testcase_17 AC 503 ms
60,744 KB
testcase_18 AC 243 ms
59,672 KB
testcase_19 AC 549 ms
61,540 KB
testcase_20 AC 366 ms
60,020 KB
testcase_21 AC 326 ms
59,920 KB
testcase_22 AC 472 ms
60,424 KB
testcase_23 AC 396 ms
60,424 KB
testcase_24 AC 456 ms
60,136 KB
testcase_25 AC 307 ms
60,252 KB
testcase_26 AC 443 ms
60,484 KB
testcase_27 AC 533 ms
60,236 KB
testcase_28 AC 434 ms
60,508 KB
testcase_29 AC 500 ms
60,344 KB
testcase_30 AC 452 ms
60,288 KB
testcase_31 AC 331 ms
60,264 KB
testcase_32 AC 350 ms
60,084 KB
testcase_33 AC 521 ms
60,328 KB
testcase_34 AC 282 ms
59,992 KB
testcase_35 AC 485 ms
60,372 KB
testcase_36 AC 530 ms
60,440 KB
testcase_37 AC 526 ms
60,328 KB
testcase_38 AC 549 ms
60,836 KB
testcase_39 AC 541 ms
60,984 KB
testcase_40 AC 511 ms
60,564 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