結果

問題 No.2374 ASKT Subsequences
ユーザー ochiaigawaochiaigawa
提出日時 2023-07-07 23:03:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 691 bytes
コンパイル時間 3,078 ms
コンパイル使用メモリ 169,028 KB
実行使用メモリ 18,876 KB
最終ジャッジ日時 2023-09-29 00:41:13
合計ジャッジ時間 5,042 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 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 3 ms
4,380 KB
testcase_11 AC 5 ms
5,092 KB
testcase_12 AC 3 ms
4,376 KB
testcase_13 AC 3 ms
4,380 KB
testcase_14 AC 6 ms
6,408 KB
testcase_15 AC 8 ms
7,056 KB
testcase_16 AC 5 ms
5,684 KB
testcase_17 AC 10 ms
8,004 KB
testcase_18 AC 40 ms
10,912 KB
testcase_19 AC 34 ms
10,120 KB
testcase_20 AC 54 ms
13,600 KB
testcase_21 AC 62 ms
14,944 KB
testcase_22 AC 49 ms
12,560 KB
testcase_23 AC 40 ms
10,972 KB
testcase_24 AC 40 ms
10,972 KB
testcase_25 AC 38 ms
10,900 KB
testcase_26 AC 85 ms
18,816 KB
testcase_27 AC 74 ms
18,816 KB
testcase_28 AC 79 ms
18,824 KB
testcase_29 AC 74 ms
18,820 KB
testcase_30 AC 76 ms
18,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const int M = 2005;
int main() {
  cin.tie(0); cout.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> A(N);
  vector<vector<int>> C(M, vector<int>(N + 1, 0));
  for(int i = 0; i < N; i++) {
    cin >> A[i];
    C[A[i]][i + 1]++;
    for(int j = 0; j < M; j++) {
      C[j][i + 1] += C[j][i];
    }
  }

  // i -> a3, j -> a2
  long long ans = 0;
  for(int i = 0; i < N; i++) {
    for(int j = 0; j < i; j++) {
      if(A[j] > A[i] && A[i] > 10) {
        long long L = C[A[i] - 10][j];
        long long R = C[A[j] + 1].back() - C[A[j] + 1][i];
        ans += L * R;
      }
    }
  }
  cout << ans << '\n';
  return 0;
}
0