結果
問題 | No.2374 ASKT Subsequences |
ユーザー | erbowl |
提出日時 | 2023-07-07 22:21:07 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 845 bytes |
コンパイル時間 | 2,499 ms |
コンパイル使用メモリ | 207,512 KB |
実行使用メモリ | 11,320 KB |
最終ジャッジ日時 | 2023-09-28 23:46:21 |
合計ジャッジ時間 | 7,231 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
8,756 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 2 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,380 KB |
testcase_04 | AC | 2 ms
4,376 KB |
testcase_05 | WA | - |
testcase_06 | AC | 2 ms
4,376 KB |
testcase_07 | AC | 2 ms
4,380 KB |
testcase_08 | WA | - |
testcase_09 | AC | 2 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 | TLE | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
ソースコード
typedef long long ll; typedef long double ld; #include <bits/stdc++.h> using namespace std; #define int long long signed main(){ ll n; std::cin >> n; vector<ll> a(n); vector<vector<ll>> p(n); for (int i = 0; i < n; i++) { std::cin >> a[i]; } for (int i = 0; i < n; i++) { for (int j = i+1; j < n; j++) { if(a[i]+1==a[j]){ p[i].push_back(j); } } } ll ans = 0; multiset<ll> ms; for (int i = 0; i < n; i++) { for (int j = i+1; j < n; j++) { ms.erase(j); if(j>i+1){ for (auto e : p[j-1]) { ms.insert(e); } } if(a[i]+10==a[j]){ ans += ms.size(); } } } std::cout << ans << std::endl; }