結果

問題 No.365 ジェンガソート
ユーザー tetsuzuki1115tetsuzuki1115
提出日時 2017-11-09 16:53:18
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 643 bytes
コンパイル時間 548 ms
コンパイル使用メモリ 81,576 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-03 08:47:56
合計ジャッジ時間 2,242 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    int N;
    cin >> N;
    vector<int> A(N);
    for ( int i = 0; i < N; i++ ) {
        cin >> A[i];
    }
    
    int x = 0;
    for ( int i = N-1; i >= 0; i-- ) {
        if ( A[i] != i+1 ) {
            x = i;
            break;
        }
    }
    
    if ( A[0] == x ) { x--; }
    
    cout << x << endl;
    
    return 0;
}
0