結果

問題 No.365 ジェンガソート
ユーザー tadanoningentadanoningen
提出日時 2021-01-21 23:30:42
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 393 bytes
コンパイル時間 627 ms
コンパイル使用メモリ 76,864 KB
実行使用メモリ 5,272 KB
最終ジャッジ日時 2023-08-26 15:17:16
合計ジャッジ時間 2,510 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 WA -
testcase_12 AC 2 ms
4,384 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 9 ms
4,380 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 15 ms
4,380 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 6 ms
4,376 KB
testcase_35 WA -
testcase_36 AC 27 ms
4,376 KB
testcase_37 AC 27 ms
4,376 KB
testcase_38 AC 27 ms
4,376 KB
testcase_39 AC 27 ms
4,376 KB
testcase_40 AC 27 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
using ll = long long;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(auto &x: a) cin >> x;

    int x = a[n-1],cnt = 1,ans = n;

    for(int i=n-1;i >= 0;i--){
        if(a[i] == x-1){
            x--;
            cnt++;
        }
    }

    ans -= cnt;
    cout << ans << endl;
    return 0;
}
0