結果

問題 No.2374 ASKT Subsequences
ユーザー 👑 timitimi
提出日時 2024-02-13 22:00:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 202 ms / 2,000 ms
コード長 338 bytes
コンパイル時間 374 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 76,592 KB
最終ジャッジ日時 2024-02-13 22:00:16
合計ジャッジ時間 5,570 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 40 ms
59,000 KB
testcase_02 AC 38 ms
53,460 KB
testcase_03 AC 46 ms
59,096 KB
testcase_04 AC 43 ms
59,768 KB
testcase_05 AC 41 ms
59,000 KB
testcase_06 AC 41 ms
59,000 KB
testcase_07 AC 76 ms
75,736 KB
testcase_08 AC 70 ms
75,676 KB
testcase_09 AC 71 ms
76,052 KB
testcase_10 AC 77 ms
75,896 KB
testcase_11 AC 74 ms
75,956 KB
testcase_12 AC 68 ms
75,680 KB
testcase_13 AC 72 ms
75,972 KB
testcase_14 AC 71 ms
75,680 KB
testcase_15 AC 72 ms
75,688 KB
testcase_16 AC 71 ms
75,680 KB
testcase_17 AC 87 ms
75,896 KB
testcase_18 AC 96 ms
75,896 KB
testcase_19 AC 93 ms
76,024 KB
testcase_20 AC 154 ms
76,428 KB
testcase_21 AC 162 ms
76,428 KB
testcase_22 AC 143 ms
76,416 KB
testcase_23 AC 101 ms
76,024 KB
testcase_24 AC 96 ms
76,024 KB
testcase_25 AC 60 ms
68,404 KB
testcase_26 AC 188 ms
76,428 KB
testcase_27 AC 198 ms
76,592 KB
testcase_28 AC 61 ms
68,664 KB
testcase_29 AC 202 ms
76,476 KB
testcase_30 AC 108 ms
76,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int, input().split()))
aa=max(A)+10;ans=0
for k in range(1,max(A)+1):
  dp1=[0]*aa;dp2=[0]*aa;dp3=[0]*aa;dp4=[0]*aa
  x,y,z=k+1,-k,k+10
  for a in A:
    if aa>a-x>0:
      dp4[a]+=dp3[a-x]
    if aa>a-y>0:
      dp3[a]+=dp2[a-y]
    if aa>a-z>0:
      dp2[a]+=dp1[a-z]
    dp1[a]+=1 
  ans+=sum(dp4)
print(ans)
0