結果
問題 | No.2374 ASKT Subsequences |
ユーザー | Kude |
提出日時 | 2023-07-07 21:50:07 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 35 ms / 2,000 ms |
コード長 | 1,182 bytes |
コンパイル時間 | 2,398 ms |
コンパイル使用メモリ | 222,896 KB |
実行使用メモリ | 18,672 KB |
最終ジャッジ日時 | 2023-09-28 22:57:28 |
合計ジャッジ時間 | 3,835 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,384 KB |
testcase_02 | AC | 2 ms
4,380 KB |
testcase_03 | AC | 2 ms
4,380 KB |
testcase_04 | AC | 2 ms
4,376 KB |
testcase_05 | AC | 2 ms
4,376 KB |
testcase_06 | AC | 2 ms
4,376 KB |
testcase_07 | AC | 2 ms
4,380 KB |
testcase_08 | AC | 2 ms
4,376 KB |
testcase_09 | AC | 2 ms
4,380 KB |
testcase_10 | AC | 2 ms
4,376 KB |
testcase_11 | AC | 3 ms
4,664 KB |
testcase_12 | AC | 2 ms
4,376 KB |
testcase_13 | AC | 3 ms
4,380 KB |
testcase_14 | AC | 4 ms
4,876 KB |
testcase_15 | AC | 4 ms
5,152 KB |
testcase_16 | AC | 4 ms
4,820 KB |
testcase_17 | AC | 6 ms
6,972 KB |
testcase_18 | AC | 10 ms
8,388 KB |
testcase_19 | AC | 10 ms
8,276 KB |
testcase_20 | AC | 19 ms
13,660 KB |
testcase_21 | AC | 25 ms
13,776 KB |
testcase_22 | AC | 19 ms
12,112 KB |
testcase_23 | AC | 11 ms
8,264 KB |
testcase_24 | AC | 10 ms
8,316 KB |
testcase_25 | AC | 4 ms
4,380 KB |
testcase_26 | AC | 35 ms
14,820 KB |
testcase_27 | AC | 9 ms
4,376 KB |
testcase_28 | AC | 13 ms
4,376 KB |
testcase_29 | AC | 16 ms
18,672 KB |
testcase_30 | AC | 12 ms
9,084 KB |
ソースコード
#include<bits/stdc++.h> namespace { #pragma GCC diagnostic ignored "-Wunused-function" #include<atcoder/all> #pragma GCC diagnostic warning "-Wunused-function" using namespace std; using namespace atcoder; #define rep(i,n) for(int i = 0; i < (int)(n); i++) #define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--) #define all(x) begin(x), end(x) #define rall(x) rbegin(x), rend(x) template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; } template<class T> bool chmin(T& a, const T& b) { if (b < a) { a = b; return true; } else return false; } using ll = long long; using P = pair<int,int>; using VI = vector<int>; using VVI = vector<VI>; using VL = vector<ll>; using VVL = vector<VL>; int d[2010][2010]; } int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; VI a(n); rep(i, n) cin >> a[i]; ll ans = 0; rep(i, n) { for(int j = i + 1; j < n; j++) { int a0 = a[i] - 10; int k = a[j] - a0 - 11; if (k <= 0) continue; int a1 = a0 + k + 10; if (1 <= a0 && a1 <= 2000) { ans += d[a0][a1]; } } rep(k, i) d[a[k]][a[i]]++; } cout << ans << '\n'; }