結果
問題 | No.2374 ASKT Subsequences |
ユーザー | kwm_t |
提出日時 | 2023-07-07 23:32:15 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 217 ms / 2,000 ms |
コード長 | 1,499 bytes |
コンパイル時間 | 2,214 ms |
コンパイル使用メモリ | 201,012 KB |
実行使用メモリ | 114,968 KB |
最終ジャッジ日時 | 2023-09-29 01:16:04 |
合計ジャッジ時間 | 5,335 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 5 ms
4,376 KB |
testcase_01 | AC | 5 ms
4,376 KB |
testcase_02 | AC | 5 ms
4,376 KB |
testcase_03 | AC | 5 ms
4,580 KB |
testcase_04 | AC | 6 ms
4,672 KB |
testcase_05 | AC | 5 ms
6,552 KB |
testcase_06 | AC | 5 ms
6,280 KB |
testcase_07 | AC | 12 ms
13,372 KB |
testcase_08 | AC | 11 ms
11,360 KB |
testcase_09 | AC | 12 ms
10,156 KB |
testcase_10 | AC | 27 ms
23,740 KB |
testcase_11 | AC | 22 ms
19,016 KB |
testcase_12 | AC | 17 ms
20,756 KB |
testcase_13 | AC | 18 ms
14,884 KB |
testcase_14 | AC | 27 ms
20,904 KB |
testcase_15 | AC | 30 ms
20,996 KB |
testcase_16 | AC | 24 ms
20,232 KB |
testcase_17 | AC | 57 ms
34,696 KB |
testcase_18 | AC | 73 ms
43,048 KB |
testcase_19 | AC | 71 ms
39,056 KB |
testcase_20 | AC | 168 ms
79,244 KB |
testcase_21 | AC | 177 ms
82,072 KB |
testcase_22 | AC | 143 ms
77,072 KB |
testcase_23 | AC | 75 ms
38,648 KB |
testcase_24 | AC | 74 ms
41,292 KB |
testcase_25 | AC | 12 ms
4,380 KB |
testcase_26 | AC | 217 ms
90,620 KB |
testcase_27 | AC | 215 ms
20,112 KB |
testcase_28 | AC | 20 ms
4,452 KB |
testcase_29 | AC | 149 ms
114,968 KB |
testcase_30 | AC | 36 ms
45,992 KB |
ソースコード
#include <bits/stdc++.h> //#include <atcoder/all> using namespace std; //using namespace atcoder; //using mint = modint1000000007; //const int mod = 1000000007; //using mint = modint998244353; //const int mod = 998244353; //const int INF = 1e9; //const long long LINF = 1e18; #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i,l,r)for(int i=(l);i<(r);++i) #define rrep(i, n) for (int i = (n-1); i >= 0; --i) #define rrep2(i,l,r)for(int i=(r-1);i>=(l);--i) #define all(x) (x).begin(),(x).end() #define allR(x) (x).rbegin(),(x).rend() #define endl "\n" #define P pair<int,int> template<typename A, typename B> inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; } template<typename A, typename B> inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; } long long dp[2002][4][2002]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<int>a(n); rep(i, n)cin >> a[i]; rep(i, n) { rep2(j, 1, 2002) { int fir = a[i] - (j + 10 + 1); if (fir >= 0) dp[fir][3][j] += dp[fir][2][j]; } rep2(j, 1, 2002) { int fir = a[i] - (10); if (fir >= 0) dp[fir][2][j] += dp[fir][1][j]; } rep2(j, 1, 2002) { int fir = a[i] - (j + 10); if (fir >= 0) dp[fir][1][j] += dp[fir][0][j]; } rep2(j, 1, 2002) { int fir = a[i]; if (fir >= 0) dp[fir][0][j] += 1; } } long long ans = 0; rep(i, 2002)rep(j, 2002) ans += dp[i][3][j]; cout << ans << endl; return 0; }