結果

問題 No.2374 ASKT Subsequences
ユーザー hiro71687khiro71687k
提出日時 2023-07-12 17:39:31
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 957 ms / 2,000 ms
コード長 689 bytes
コンパイル時間 2,047 ms
コンパイル使用メモリ 208,944 KB
実行使用メモリ 128,356 KB
最終ジャッジ日時 2023-10-12 07:58:01
合計ジャッジ時間 8,530 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 1 ms
4,372 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 AC 1 ms
4,372 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 2 ms
4,352 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 3 ms
4,348 KB
testcase_11 AC 13 ms
6,004 KB
testcase_12 AC 6 ms
4,480 KB
testcase_13 AC 5 ms
4,352 KB
testcase_14 AC 24 ms
7,296 KB
testcase_15 AC 37 ms
8,972 KB
testcase_16 AC 17 ms
6,492 KB
testcase_17 AC 74 ms
15,252 KB
testcase_18 AC 177 ms
26,152 KB
testcase_19 AC 157 ms
23,808 KB
testcase_20 AC 383 ms
53,676 KB
testcase_21 AC 512 ms
64,132 KB
testcase_22 AC 323 ms
45,912 KB
testcase_23 AC 177 ms
25,832 KB
testcase_24 AC 180 ms
25,976 KB
testcase_25 AC 7 ms
4,352 KB
testcase_26 AC 912 ms
91,036 KB
testcase_27 AC 23 ms
4,348 KB
testcase_28 AC 121 ms
4,352 KB
testcase_29 AC 957 ms
128,356 KB
testcase_30 AC 178 ms
17,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll mod=998244353;
ld inf=10000999999999900;
int main(){
    ll n;
    cin >> n;
    vector<ll>a(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    map<pair<ll,ll>,ll>memo;
    ll ans=0;
    for (ll i = n-2; i >=0; i--)
    {
        for (ll j = i-1; j >=0; j--)
        {
            ll k=a[i]-a[j]-10;
            if (k<=0)
            {
                continue;
            }
            ans+=memo[{a[i]-k,a[i]-k+k+1}];
        }
        for (ll j = i+1; j <n; j++)
        {
            memo[{a[i],a[j]}]++;
        }
    }
    cout << ans << endl;
}
0