結果

問題 No.2374 ASKT Subsequences
ユーザー HimatsubushinHimatsubushin
提出日時 2023-07-11 15:24:01
言語 C90
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 778 bytes
コンパイル時間 507 ms
コンパイル使用メモリ 25,412 KB
実行使用メモリ 8,704 KB
最終ジャッジ日時 2023-10-11 06:26:49
合計ジャッジ時間 8,508 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,968 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 0 ms
4,352 KB
testcase_03 AC 1 ms
4,356 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 0 ms
4,352 KB
testcase_07 AC 1 ms
4,352 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,352 KB
testcase_10 AC 6 ms
4,348 KB
testcase_11 AC 225 ms
4,356 KB
testcase_12 AC 33 ms
4,348 KB
testcase_13 AC 19 ms
4,352 KB
testcase_14 AC 842 ms
4,376 KB
testcase_15 TLE -
testcase_16 AC 398 ms
4,352 KB
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

#define N 2000

bool check(int, int, int, int);

int main(void) {
    int a, b, c, d, i, n, count, x[N];

    scanf("%d", &n);
    for (i = 0; i < n; i++)
        scanf("%d", &x[i]);

    count = 0;
    for (a = 0; a < n - 3; a++)
        for (b = a + 1; b < n - 2; b++)
            for (c = b + 1; c < n - 1; c++)
                for (d = c + 1; d < n; d++)
                    if (check(x[a], x[b], x[c], x[d]))
                        count++;

    printf("%d\n", count);

    return EXIT_SUCCESS;
}

bool check(int a, int b, int c, int d) {
    int k1, k2, k3;

    k1 = b - a - 10;
    k2 = b - c;
    k3 = d - c - 1;

    if (k1 > 0 && k1 == k2 && k2 == k3)
        return true;
    else
        return false;
}
0