結果
| 問題 |
No.2374 ASKT Subsequences
|
| コンテスト | |
| ユーザー |
as277575
|
| 提出日時 | 2023-07-07 22:50:22 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1,845 ms / 2,000 ms |
| コード長 | 1,326 bytes |
| コンパイル時間 | 1,349 ms |
| コンパイル使用メモリ | 126,388 KB |
| 最終ジャッジ日時 | 2025-02-15 08:08:54 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
#include <algorithm>
#include <bit>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <random>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <set>
#include <string>
using namespace::std;
template<typename T, typename U>
ostream& operator<< (ostream& o, const pair<T, U>& p) {
o << "<" << p.first << ", " << p.second << ">";
return o;
}
template <typename T>
ostream& operator<< (ostream& o, const vector<T>& v) {
for (const auto& x : v) o << x << " ";
return o;
}
ostream& operator<<(ostream& o, const unordered_map<long long, long long>& m) {
o << "{";
for (const auto& [k, v] : m)
o << " " << k << ": " << v << ",";
o << "}";
return o;
}
template <typename T>
istream& operator>> (istream& i, vector<T>& v) {
for (auto& x : v) i >> x;
return i;
}
int main() {
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n);
cin >> a;
long long r = 0;
for (int k = 1; k <= 2000; ++k) {
vector<unordered_map<int, int>> d(3);
for (int ax : a) {
d[0][ax]++;
d[1][ax] += d[0][ax - k - 10];
d[2][ax] += d[1][ax + k];
r += d[2][ax - k - 1];
}
}
// c[i] * c[i + k + 10] * c[i + 10] * c[i + k + 11];
cout << r << endl;
return 0;
}
as277575