結果

問題 No.365 ジェンガソート
ユーザー irO HairiirO Hairi
提出日時 2022-05-18 06:43:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 664 bytes
コンパイル時間 524 ms
コンパイル使用メモリ 65,172 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-10-14 11:06:49
合計ジャッジ時間 2,888 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
using namespace std;
#define MAX_SIZE 1000
#define check cout << "OK" << endl;

int main() {
    int block_sizes[MAX_SIZE];

    int block_num;
    cin >> block_num;

    if (!cin || MAX_SIZE < block_num) {
        exit(100);
    }

    int max_size = block_num;
    int cnt = 0;
    int ans;

    for (int i = 0; i < block_num; i++) {
        cin >> block_sizes[i];
        if (!cin) {
            exit(100);
        }
    }

    for (int i = block_num - 1; i >= 0; i--) {
        if (block_sizes[i] == max_size) {
            cnt++;
            max_size--;
        }
    }

    ans = block_num - cnt;
    cout << ans << endl;

    return 0;
}
0