結果
| 問題 |
No.2374 ASKT Subsequences
|
| コンテスト | |
| ユーザー |
shobonvip
|
| 提出日時 | 2023-07-07 22:44:46 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 970 bytes |
| コンパイル時間 | 3,970 ms |
| コンパイル使用メモリ | 250,728 KB |
| 最終ジャッジ日時 | 2025-02-15 08:02:10 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 WA * 17 |
ソースコード
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
typedef modint998244353 mint;
typedef long long ll;
#define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
#define rrep(i, s, n) for (int i = (int)(n)-1; i >= (int)(s); i--)
template <typename T> bool chmin(T &a, const T &b) {
if (a <= b) return false;
a = b;
return true;
}
template <typename T> bool chmax(T &a, const T &b) {
if (a >= b) return false;
a = b;
return true;
}
int main(){
int n; cin >> n;
vector<int> a(n);
rep(i,0,n) cin >> a[i];
ll ans = 0;
rep(k,1,n+1){
vector<ll> dp0(2001);
vector<ll> dp1(2001);
vector<ll> dp2(2001);
vector<ll> dp3(2001);
rep(i,0,n){
// 3
if (a[i]-k-1 >= 0) dp3[a[i]] += dp2[a[i]-k-1];
// 2
if (a[i]+k <= 2000) dp2[a[i]] += dp1[a[i]+k];
// 1
if (a[i]-k-10 >= 0) dp1[a[i]] += dp0[a[i]-k-10];
// 0
dp0[a[i]] += 1;
}
rep(i,0,2001){
ans += dp3[i];
}
}
cout << ans << endl;
}
shobonvip