結果

問題 No.365 ジェンガソート
ユーザー iqueue02
提出日時 2020-03-09 22:02:08
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 386 bytes
コンパイル時間 1,539 ms
コンパイル使用メモリ 169,212 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-14 13:31:56
合計ジャッジ時間 3,353 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;
constexpr int INF = 1e9;
int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int now = n;
  for (int i = n-1; i >= 0; i--) {
    if (a[i] == now) now--;
  }
  cout << now << endl;
  return 0;
}
0