結果
問題 |
No.2374 ASKT Subsequences
|
ユーザー |
![]() |
提出日時 | 2023-07-11 10:09:38 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 832 bytes |
コンパイル時間 | 406 ms |
コンパイル使用メモリ | 42,112 KB |
実行使用メモリ | 33,468 KB |
最終ジャッジ日時 | 2024-09-13 00:11:16 |
合計ジャッジ時間 | 1,746 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 WA * 13 |
ソースコード
/* -*- coding: utf-8 -*- * * 2374.cc: No.2374 ASKT Subsequences - yukicoder */ #include<cstdio> #include<algorithm> using namespace std; /* constant */ const int MAX_N = 2000; const int MAX_A = 2000; /* typedef */ typedef long long ll; /* global variables */ int as[MAX_N]; ll dp1[MAX_A], dp2[MAX_A][MAX_A], dp3[MAX_A]; /* subroutines */ /* main */ int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", as + i), as[i]--; // a2=a1+k+10, a3=a1+10, a4=a1+k+11=a2+1 ll dp4 = 0; for (int i = 0; i < n; i++) { int ai = as[i]; if (ai > 0) dp4 += dp3[ai - 1]; if (ai >= 10) for (int aj = 0; aj < MAX_A; aj++) dp3[aj] += dp2[ai - 10][aj]; for (int aj = 0; aj <= ai - 10; aj++) dp2[aj][ai] += dp1[aj]; dp1[ai]++; } printf("%lld\n", dp4); return 0; }