結果

問題 No.365 ジェンガソート
ユーザー moja
提出日時 2016-05-30 17:14:10
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 321 bytes
コンパイル時間 2,348 ms
コンパイル使用メモリ 157,420 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-07 18:46:20
合計ジャッジ時間 3,353 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int a[100000];
int main(){
  int n;
  cin>>n;
  int maxx=-1;
  int maxc=1;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  maxx=a[n-1];
  for(int i=n-1;i>=0;i--){
    //cout<<a[i]<<endl;
    if(maxx-1 == a[i]){
      maxc++;
      maxx = a[i];
    }
  }

  cout<<n-maxc<<endl;
}
0