結果

問題 No.365 ジェンガソート
ユーザー Daigo HIROOKADaigo HIROOKA
提出日時 2018-07-04 02:32:36
言語 Java21
(openjdk 21)
結果
AC  
実行時間 523 ms / 2,000 ms
コード長 384 bytes
コンパイル時間 3,063 ms
コンパイル使用メモリ 71,584 KB
実行使用メモリ 61,396 KB
最終ジャッジ日時 2023-09-13 17:26:34
合計ジャッジ時間 17,936 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,524 KB
testcase_01 AC 121 ms
55,676 KB
testcase_02 AC 123 ms
56,068 KB
testcase_03 AC 120 ms
55,740 KB
testcase_04 AC 120 ms
55,960 KB
testcase_05 AC 120 ms
55,972 KB
testcase_06 AC 123 ms
56,424 KB
testcase_07 AC 122 ms
56,460 KB
testcase_08 AC 121 ms
56,744 KB
testcase_09 AC 119 ms
56,356 KB
testcase_10 AC 120 ms
55,700 KB
testcase_11 AC 122 ms
55,604 KB
testcase_12 AC 123 ms
56,020 KB
testcase_13 AC 126 ms
56,152 KB
testcase_14 AC 122 ms
56,000 KB
testcase_15 AC 129 ms
55,996 KB
testcase_16 AC 484 ms
60,504 KB
testcase_17 AC 470 ms
60,408 KB
testcase_18 AC 232 ms
59,504 KB
testcase_19 AC 518 ms
61,396 KB
testcase_20 AC 330 ms
60,604 KB
testcase_21 AC 299 ms
59,872 KB
testcase_22 AC 446 ms
60,660 KB
testcase_23 AC 377 ms
60,368 KB
testcase_24 AC 441 ms
60,564 KB
testcase_25 AC 297 ms
60,764 KB
testcase_26 AC 439 ms
60,536 KB
testcase_27 AC 497 ms
60,404 KB
testcase_28 AC 408 ms
60,756 KB
testcase_29 AC 499 ms
60,944 KB
testcase_30 AC 434 ms
60,568 KB
testcase_31 AC 310 ms
60,096 KB
testcase_32 AC 314 ms
60,504 KB
testcase_33 AC 484 ms
60,308 KB
testcase_34 AC 275 ms
60,308 KB
testcase_35 AC 447 ms
60,324 KB
testcase_36 AC 478 ms
60,796 KB
testcase_37 AC 487 ms
60,884 KB
testcase_38 AC 516 ms
60,392 KB
testcase_39 AC 523 ms
60,864 KB
testcase_40 AC 489 ms
60,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class No365{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++){
			a[i] = sc.nextInt();
		}
		int m = n;
		int count = 0;
		for(int i = n-1; i >= 0; i--){
			if(a[i] == m){
				m--;
			}else{
				count++;
			}
		}
		System.out.println(count);
	}
}
0