結果

問題 No.365 ジェンガソート
ユーザー DaYuanChi
提出日時 2021-01-26 14:46:53
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 362 bytes
コンパイル時間 1,456 ms
コンパイル使用メモリ 168,276 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-23 14:23:33
合計ジャッジ時間 3,567 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
  int n; cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  reverse(a.begin(), a.end());
  int at = n;
  int cnt = 0;
  for(int i = 0; i < n; i++){
    if(a[i]==at){
      at--;
      cnt++;
    }
  }
  int ans = n - cnt;
  cout << ans << endl;
  return 0;
}
0