結果

問題 No.365 ジェンガソート
ユーザー ninoinui
提出日時 2020-02-16 05:22:49
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 262 bytes
コンパイル時間 1,592 ms
コンパイル使用メモリ 167,488 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-06 14:18:41
合計ジャッジ時間 3,685 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  int cnt = 0, n = N;
  for (int i = N - 1; i >= 0; i--) if (A.at(i) == n) cnt++, n--;
  cout << N - cnt << "\n";
}
0