結果
| 問題 |
No.2374 ASKT Subsequences
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-07-07 23:14:30 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 563 bytes |
| コンパイル時間 | 1,969 ms |
| コンパイル使用メモリ | 201,780 KB |
| 最終ジャッジ日時 | 2025-02-15 08:27:04 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 WA * 2 |
ソースコード
#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];
int ans {};
for (int i=0;i<n;++i) { // a_1
map<int, pair<int, int>> mp;
for (int j=n-1;i<j;--j) { // a_2
int k = a[j] - a[i] - 10; // 10 + k
if (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';
}