結果

問題 No.2374 ASKT Subsequences
ユーザー umezoumezo
提出日時 2023-07-09 07:13:39
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 836 bytes
コンパイル時間 2,361 ms
コンパイル使用メモリ 202,632 KB
実行使用メモリ 34,628 KB
最終ジャッジ日時 2023-09-30 09:43:28
合計ジャッジ時間 4,794 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 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,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,616 KB
testcase_11 AC 5 ms
7,144 KB
testcase_12 AC 3 ms
5,672 KB
testcase_13 AC 2 ms
5,100 KB
testcase_14 AC 6 ms
8,996 KB
testcase_15 AC 8 ms
10,588 KB
testcase_16 AC 5 ms
8,064 KB
testcase_17 AC 11 ms
13,068 KB
testcase_18 AC 20 ms
18,612 KB
testcase_19 AC 15 ms
17,228 KB
testcase_20 AC 27 ms
24,048 KB
testcase_21 AC 29 ms
26,508 KB
testcase_22 AC 22 ms
21,668 KB
testcase_23 AC 17 ms
18,812 KB
testcase_24 AC 17 ms
18,876 KB
testcase_25 AC 13 ms
18,776 KB
testcase_26 AC 45 ms
34,628 KB
testcase_27 AC 30 ms
34,400 KB
testcase_28 AC 35 ms
34,396 KB
testcase_29 AC 30 ms
34,452 KB
testcase_30 AC 30 ms
34,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);

  int n;
  cin>>n;
  vector<int> A(n);
  rep(i,n) cin>>A[i];
  
  vector<vector<int>> L(n,vector<int> (2001)),R(n,vector<int> (2001));
  L[0][A[0]]=1,R[n-1][A[n-1]]=1;
  for(int i=1;i<n;i++){
    for(int j=1;j<=2000;j++) L[i][j]=L[i-1][j];
    L[i][A[i]]++;
  }
  for(int i=n-2;i>=0;i--){
    for(int j=1;j<=2000;j++) R[i][j]=R[i+1][j];
    R[i][A[i]]++;
  }
  ll ans=0;
  for(int i=1;i<n-2;i++){
    for(int j=i+1;j<n-1;j++){
      if(A[i]<=A[j]) continue;
      if(A[j]-10<1) continue;
      if(A[i]+1>2000) continue;
      ans+=(ll)L[i-1][A[j]-10]*R[j+1][A[i]+1];
    }
  }
  cout<<ans<<endl;

  return 0;
}
0