結果

問題 No.2374 ASKT Subsequences
ユーザー inkyamaninkyaman
提出日時 2024-03-25 22:31:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 993 bytes
コンパイル時間 1,213 ms
コンパイル使用メモリ 120,740 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2024-03-25 22:31:31
合計ジャッジ時間 9,648 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 196 ms
6,548 KB
testcase_01 AC 218 ms
6,548 KB
testcase_02 AC 195 ms
6,548 KB
testcase_03 AC 195 ms
6,548 KB
testcase_04 AC 195 ms
6,548 KB
testcase_05 AC 195 ms
6,548 KB
testcase_06 AC 208 ms
6,548 KB
testcase_07 AC 195 ms
6,548 KB
testcase_08 AC 195 ms
6,548 KB
testcase_09 AC 197 ms
6,548 KB
testcase_10 AC 195 ms
6,548 KB
testcase_11 AC 198 ms
6,548 KB
testcase_12 AC 221 ms
6,548 KB
testcase_13 AC 196 ms
6,548 KB
testcase_14 AC 199 ms
6,548 KB
testcase_15 AC 199 ms
6,548 KB
testcase_16 AC 197 ms
6,548 KB
testcase_17 AC 202 ms
6,548 KB
testcase_18 AC 205 ms
6,548 KB
testcase_19 AC 204 ms
6,548 KB
testcase_20 AC 209 ms
6,548 KB
testcase_21 AC 212 ms
6,548 KB
testcase_22 AC 207 ms
6,548 KB
testcase_23 AC 229 ms
6,548 KB
testcase_24 AC 204 ms
6,548 KB
testcase_25 WA -
testcase_26 AC 219 ms
6,548 KB
testcase_27 WA -
testcase_28 AC 230 ms
6,548 KB
testcase_29 AC 210 ms
6,548 KB
testcase_30 AC 207 ms
6,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <math.h>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <iomanip>
#include <climits>
#include <functional>
#include <cassert>
#include <tuple>
using namespace std;
using ll = long long;

int N;
int A[2020];

int main() {

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

    ll ans = 0;
    for(int k = 1; k <= 2000; ++k) {
        vector dp(2001, vector(4,0));
        for(int i = 0; i < N; ++i) {
            int a3 = A[i]-k-1;
            if(a3 > 0 && a3 <= 2000) dp[A[i]][3] += dp[a3][2];
            int a2 = A[i]+k;
            if(a2 > 0 && a2 <= 2000) dp[A[i]][2] += dp[a2][1];
            int a1 = A[i]-k-10;
            if(a1 > 0 && a1 <= 2000) dp[A[i]][1] += dp[a1][0];
            dp[A[i]][0]++;
        }
        for(int i = 1; i <= 2000; ++i) ans += dp[i][3];
    }

    cout << ans << endl;

}

0