結果

問題 No.2374 ASKT Subsequences
ユーザー poyonpoyon
提出日時 2023-06-20 22:25:28
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 967 bytes
コンパイル時間 2,185 ms
コンパイル使用メモリ 203,080 KB
実行使用メモリ 8,768 KB
最終ジャッジ日時 2023-09-12 09:57:56
合計ジャッジ時間 9,069 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,568 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 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 4 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 8 ms
4,376 KB
testcase_15 AC 14 ms
4,376 KB
testcase_16 AC 5 ms
4,380 KB
testcase_17 AC 28 ms
4,384 KB
testcase_18 AC 98 ms
4,380 KB
testcase_19 AC 76 ms
4,380 KB
testcase_20 AC 231 ms
4,380 KB
testcase_21 AC 333 ms
4,376 KB
testcase_22 AC 171 ms
4,380 KB
testcase_23 AC 99 ms
4,380 KB
testcase_24 AC 99 ms
4,380 KB
testcase_25 AC 901 ms
4,376 KB
testcase_26 AC 799 ms
4,380 KB
testcase_27 TLE -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

// 嘘解法 (TLE)
// 愚直 O(N^4) を QCFium法 で定数倍高速化

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);

    int N;
    cin >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) { cin >> A[i]; }

    ll ans = 0;
    for (int i1 = 0; i1 < N - 3; i1++) {
        for (int i2 = i1 + 1; i2 < N - 2; i2++) {
            int n = A[i2] - A[i1] - 10;
            if (n <= 0) { continue; }
            for (int i3 = i2 + 1; i3 < N - 1; i3++) {
                if (A[i3] != A[i2] - n) { continue; }
                for (int i4 = i3 + 1; i4 < N; i4++) {
                    if (A[i4] != A[i3] + (n + 1)) { continue; }
                    ans++;
                }
            }
        }
    }
    cout << ans << '\n';

    return 0;
}
0