結果

問題 No.365 ジェンガソート
ユーザー kohaku_kohaku
提出日時 2016-11-16 18:25:30
言語 Java
(openjdk 23)
結果
AC  
実行時間 599 ms / 2,000 ms
コード長 524 bytes
コンパイル時間 2,114 ms
コンパイル使用メモリ 73,876 KB
実行使用メモリ 59,720 KB
最終ジャッジ日時 2024-11-26 02:26:11
合計ジャッジ時間 16,047 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int [] a = new int [N];
        int [] b = new int [N];
        for(int i=0; i<N; i++){
            a[i] = sc.nextInt();
        }
        int r=N;
        int t=N-1;
        for(int i=t; i>=0; i--){
            if(a[i]==r){
                r--;
                t--;
                continue;
            }
        }
        System.out.println(r);
    }
}
0