結果
問題 | No.2374 ASKT Subsequences |
ユーザー |
|
提出日時 | 2023-07-07 23:19:26 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 392 ms / 2,000 ms |
コード長 | 566 bytes |
コンパイル時間 | 2,057 ms |
コンパイル使用メモリ | 202,292 KB |
最終ジャッジ日時 | 2025-02-15 08:30:26 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {ios::sync_with_stdio(false);cin.tie(0);int n;cin >> n;vector<int> a(n);for (int i=0;i<n;++i) cin >> a[i];long ans {};for (int i=0;i<n;++i) { // a_1map<int, pair<long, long>> mp;for (int j=n-1;i<j;--j) { // a_2int k = a[j] - a[i] - 10; // 10 + kif (k == 0) {for (auto& e : mp) e.second.second += e.second.first;} else if (k > 0) {ans += mp[a[i]+k+11].second;}++mp[a[j]].first; // a_4}}cout << ans << '\n';}