結果

問題 No.2374 ASKT Subsequences
ユーザー tnakao0123tnakao0123
提出日時 2023-07-11 10:09:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 832 bytes
コンパイル時間 371 ms
コンパイル使用メモリ 41,904 KB
実行使用メモリ 33,804 KB
最終ジャッジ日時 2023-10-10 01:43:31
合計ジャッジ時間 2,008 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 3 ms
6,888 KB
testcase_08 AC 3 ms
6,968 KB
testcase_09 AC 4 ms
7,228 KB
testcase_10 AC 7 ms
14,604 KB
testcase_11 AC 5 ms
7,152 KB
testcase_12 WA -
testcase_13 AC 4 ms
8,460 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 9 ms
15,736 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 2 ms
4,348 KB
testcase_26 WA -
testcase_27 AC 43 ms
32,344 KB
testcase_28 WA -
testcase_29 AC 43 ms
25,468 KB
testcase_30 AC 8 ms
7,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 2374.cc:  No.2374 ASKT Subsequences - yukicoder
 */

#include<cstdio>
#include<algorithm>
 
using namespace std;

/* constant */

const int MAX_N = 2000;
const int MAX_A = 2000;

/* typedef */

typedef long long ll;

/* global variables */

int as[MAX_N];
ll dp1[MAX_A], dp2[MAX_A][MAX_A], dp3[MAX_A];

/* subroutines */

/* main */

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", as + i), as[i]--;

  // a2=a1+k+10, a3=a1+10, a4=a1+k+11=a2+1
  
  ll dp4 = 0;
  for (int i = 0; i < n; i++) {
    int ai = as[i];

    if (ai > 0) dp4 += dp3[ai - 1];

    if (ai >= 10)
      for (int aj = 0; aj < MAX_A; aj++) dp3[aj] += dp2[ai - 10][aj];

    for (int aj = 0; aj <= ai - 10; aj++) dp2[aj][ai] += dp1[aj];

    dp1[ai]++;
  }

  printf("%lld\n", dp4);
  return 0;
}
0