結果

問題 No.365 ジェンガソート
ユーザー gedorinku
提出日時 2016-04-30 00:48:33
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 11 ms / 2,000 ms
コード長 470 bytes
コンパイル時間 1,293 ms
コンパイル使用メモリ 157,024 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-12 01:51:40
合計ジャッジ時間 2,584 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define int long long
#define PB push_back
#define PPB pop_back
typedef pair<int, int> pii;
typedef pair<double, double> pdd;

static const int INF = 1LL << 61;

int dp[100005], n, a[100005];

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> n;
    for (int i = n - 1; 0 <= i; --i) cin >> a[i];

    int ans = n;
    for (int i = 0; i < n; ++i) if (a[i] == ans) ans--;
    cout << ans << endl;
}
0