結果

問題 No.2374 ASKT Subsequences
ユーザー FplusFplusFFplusFplusF
提出日時 2023-07-07 21:56:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 964 bytes
コンパイル時間 2,613 ms
コンパイル使用メモリ 202,580 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-28 23:06:58
合計ジャッジ時間 7,525 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll,ll>;
using ld=long double;
const ll INF=(1ll<<60);
#define rep(i,n) for (ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(),v.end()
template<class T> void chmin(T &a,T b){
    if(a>b){
        a=b;
    }
}
template<class T> void chmax(T &a,T b){
    if(a<b){
        a=b;
    }
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n;
    cin >> n;
    vector<ll> a(n);
    vector<vector<ll>> v(2001);
    rep(i,n){
        cin >> a[i];
        v[a[i]].push_back(i);
    }
    ll ans=0;
    rep(i,n){
        for(ll k=i+2;k<n;k++){
            if(a[i]+10!=a[k]) continue;
            for(ll j=i+1;j<k;j++){
                ll x=a[j]-a[i]-10;
                if(x<=0) continue;
                ans+=(ll)v[a[i]+x+11].size()-(upper_bound(all(v[a[i]+x+11]),k)-v[a[i]+x+11].begin());
            }
        }
    }
    cout << ans << '\n';
}
0