結果

問題 No.365 ジェンガソート
ユーザー shinwisteriashinwisteria
提出日時 2017-04-01 11:57:45
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 529 bytes
コンパイル時間 3,497 ms
コンパイル使用メモリ 72,896 KB
実行使用メモリ 67,232 KB
最終ジャッジ日時 2023-09-22 01:58:01
合計ジャッジ時間 11,788 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,716 KB
testcase_01 AC 122 ms
55,944 KB
testcase_02 AC 123 ms
55,752 KB
testcase_03 AC 122 ms
55,748 KB
testcase_04 AC 123 ms
55,752 KB
testcase_05 AC 123 ms
55,808 KB
testcase_06 AC 124 ms
55,520 KB
testcase_07 AC 125 ms
55,964 KB
testcase_08 AC 125 ms
55,548 KB
testcase_09 AC 126 ms
55,884 KB
testcase_10 AC 123 ms
55,756 KB
testcase_11 AC 125 ms
55,980 KB
testcase_12 AC 131 ms
55,844 KB
testcase_13 AC 131 ms
55,756 KB
testcase_14 AC 124 ms
55,540 KB
testcase_15 AC 131 ms
56,616 KB
testcase_16 AC 880 ms
67,232 KB
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.Scanner;
public class Jengasort {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner s = new Scanner(System.in);
		int N = s.nextInt();
		ArrayList<Integer> list = new ArrayList<>();
		for(int i = 0;i < N;i++){
			list.add(s.nextInt());
		}
		s.close();
		int count = N-1;
		for(int i = N-1;i > 0;i--){
			if(list.indexOf(i) < list.indexOf(i+1)){
				count--;
			}else{
				break;
			}
		}
		System.out.println(count);

	}

}
0