結果

問題 No.2374 ASKT Subsequences
ユーザー nouka28nouka28
提出日時 2023-07-07 22:07:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,164 bytes
コンパイル時間 4,678 ms
コンパイル使用メモリ 273,612 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-28 23:26:19
合計ジャッジ時間 16,147 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 3 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 4 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 3 ms
4,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 8 ms
4,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 1,521 ms
4,376 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

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]])++;
            if(st.count(a[i]+k+10))get<1>(mp[a[i]+k+10])+=get<0>(mp[a[i]]);
            if(st.count(a[i]-k))get<2>(mp[a[i]-k])+=get<1>(mp[a[i]]);
            if(st.count(a[i]+k+1))get<3>(mp[a[i]+k+1])+=get<2>(mp[a[i]]);

        }
        for(auto e:mp)ans+=(int)get<3>(e.second);
    }
    cout<<ans<<endl;
    
}
0