結果
| 問題 | No.365 ジェンガソート | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2017-04-01 11:57:45 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 529 bytes | 
| コンパイル時間 | 2,868 ms | 
| コンパイル使用メモリ | 75,080 KB | 
| 実行使用メモリ | 66,328 KB | 
| 最終ジャッジ日時 | 2024-07-07 18:47:22 | 
| 合計ジャッジ時間 | 9,283 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 17 TLE * 1 -- * 23 | 
ソースコード
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);
	}
}
            
            
            
        