結果

問題 No.2374 ASKT Subsequences
ユーザー nouka28nouka28
提出日時 2023-07-07 22:30:54
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,122 bytes
コンパイル時間 5,545 ms
コンパイル使用メモリ 273,364 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-09-28 23:59:16
合計ジャッジ時間 24,155 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
8,760 KB
testcase_01 AC 5 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 6 ms
4,376 KB
testcase_04 AC 9 ms
4,376 KB
testcase_05 AC 5 ms
4,380 KB
testcase_06 AC 6 ms
4,380 KB
testcase_07 AC 29 ms
4,376 KB
testcase_08 AC 17 ms
4,376 KB
testcase_09 AC 24 ms
4,380 KB
testcase_10 AC 95 ms
4,380 KB
testcase_11 AC 338 ms
4,380 KB
testcase_12 AC 181 ms
4,376 KB
testcase_13 AC 146 ms
4,380 KB
testcase_14 AC 491 ms
4,376 KB
testcase_15 AC 641 ms
4,380 KB
testcase_16 AC 411 ms
4,376 KB
testcase_17 AC 933 ms
4,376 KB
testcase_18 AC 1,414 ms
4,380 KB
testcase_19 AC 1,319 ms
4,380 KB
testcase_20 TLE -
testcase_21 TLE -
testcase_22 AC 1,870 ms
4,380 KB
testcase_23 AC 1,415 ms
4,380 KB
testcase_24 AC 1,426 ms
4,380 KB
testcase_25 AC 62 ms
4,380 KB
testcase_26 TLE -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
#define int long long
#define intu __int128_t
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define reps(i,a,b,c) for(int i=a;i<b;i+=c)
#define repnega(i,a,b) for(int i=b;i>a;i--)
#define mod2 1000000007
#define mod 998244353
#define endl '\n'
#define AC ios_base::sync_with_stdio(false);cin.tie(0);
#define pb push_back
#define eb emplace_back
#define ceil(a,b) (a+b-1)/b
// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")

int n;
signed main(){
    cin>>n;
    vector<int> a(n);
    set<int> st;
    rep(i,n)cin>>a[i];
    rep(i,n)st.insert(a[i]);
    int ans=0;
    rep1(k,2000){
        map<int,tuple<int,int,int,int>> mp;
        rep(i,n){
            get<0>(mp[a[i]])++;
            get<1>(mp[a[i]])+=get<0>(mp[a[i]-k-10]);
            get<2>(mp[a[i]])+=get<1>(mp[a[i]+k]);
            get<3>(mp[a[i]])+=get<2>(mp[a[i]-k-1]);
        }
        for(auto e:mp){
            ans+=(int)get<3>(e.second);
        }
    }
    cout<<ans<<endl;
    
}
0