結果

問題 No.2374 ASKT Subsequences
コンテスト
ユーザー Himatsubushin
提出日時 2023-07-11 15:21:21
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
TLE  
実行時間 -
コード長 778 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 242 ms
コンパイル使用メモリ 39,488 KB
最終ジャッジ日時 2026-02-22 11:00:59
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 TLE * 2 -- * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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