結果

問題 No.365 ジェンガソート
ユーザー htensaihtensai
提出日時 2019-11-21 11:02:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 551 ms / 2,000 ms
コード長 439 bytes
コンパイル時間 1,926 ms
コンパイル使用メモリ 74,140 KB
実行使用メモリ 48,900 KB
最終ジャッジ日時 2024-04-17 19:34:28
合計ジャッジ時間 16,960 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
41,788 KB
testcase_01 AC 118 ms
41,180 KB
testcase_02 AC 119 ms
40,252 KB
testcase_03 AC 119 ms
41,524 KB
testcase_04 AC 119 ms
41,216 KB
testcase_05 AC 118 ms
41,228 KB
testcase_06 AC 104 ms
41,284 KB
testcase_07 AC 104 ms
41,648 KB
testcase_08 AC 108 ms
41,648 KB
testcase_09 AC 126 ms
41,408 KB
testcase_10 AC 117 ms
41,196 KB
testcase_11 AC 117 ms
41,588 KB
testcase_12 AC 116 ms
39,856 KB
testcase_13 AC 125 ms
41,584 KB
testcase_14 AC 107 ms
41,128 KB
testcase_15 AC 126 ms
41,604 KB
testcase_16 AC 502 ms
48,296 KB
testcase_17 AC 536 ms
48,640 KB
testcase_18 AC 223 ms
47,108 KB
testcase_19 AC 525 ms
48,900 KB
testcase_20 AC 330 ms
47,544 KB
testcase_21 AC 327 ms
47,136 KB
testcase_22 AC 526 ms
48,480 KB
testcase_23 AC 370 ms
47,940 KB
testcase_24 AC 519 ms
48,568 KB
testcase_25 AC 310 ms
48,040 KB
testcase_26 AC 527 ms
48,576 KB
testcase_27 AC 551 ms
48,424 KB
testcase_28 AC 484 ms
48,176 KB
testcase_29 AC 545 ms
48,440 KB
testcase_30 AC 479 ms
48,420 KB
testcase_31 AC 319 ms
48,092 KB
testcase_32 AC 354 ms
47,900 KB
testcase_33 AC 531 ms
48,672 KB
testcase_34 AC 303 ms
47,804 KB
testcase_35 AC 520 ms
48,548 KB
testcase_36 AC 517 ms
48,056 KB
testcase_37 AC 452 ms
48,232 KB
testcase_38 AC 548 ms
48,684 KB
testcase_39 AC 521 ms
48,888 KB
testcase_40 AC 470 ms
48,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n + 1];
		for (int i = 0; i < n; i++) {
		    int x = sc.nextInt();
		    arr[x] = i;
		}
		int max = n - 1;
		for (int i = n; i > 1; i--) {
		    if (arr[i] > arr[i - 1]) {
		        max--;
		    } else {
		        break;
		    }
		}
	    System.out.println(max);
	}
}
0