結果

問題 No.365 ジェンガソート
ユーザー Naco
提出日時 2019-10-20 01:46:09
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 330 bytes
コンパイル時間 1,667 ms
コンパイル使用メモリ 166,020 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 09:57:57
合計ジャッジ時間 4,107 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
    int N; cin >> N;
    int a[N];
    for(int i=0;i<N;i++) cin >> a[i];
    int ans=0;
    int tmp=N;
    for(int i=N-1;i>=0;i--){
        if(a[i]==tmp){
            tmp--;
            continue;
        }else{
            ans++;
        }
    }
    cout << ans << endl;
}
0