結果

問題 No.2374 ASKT Subsequences
ユーザー sasa8uyauyasasa8uyauya
提出日時 2024-03-23 11:13:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 178 ms / 2,000 ms
コード長 292 bytes
コンパイル時間 550 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 76,416 KB
最終ジャッジ日時 2024-03-23 11:13:18
合計ジャッジ時間 5,088 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 42 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 39 ms
53,460 KB
testcase_04 AC 43 ms
59,580 KB
testcase_05 AC 38 ms
53,460 KB
testcase_06 AC 38 ms
53,460 KB
testcase_07 AC 76 ms
75,964 KB
testcase_08 AC 67 ms
74,552 KB
testcase_09 AC 75 ms
76,080 KB
testcase_10 AC 77 ms
75,804 KB
testcase_11 AC 66 ms
73,256 KB
testcase_12 AC 64 ms
73,256 KB
testcase_13 AC 76 ms
75,972 KB
testcase_14 AC 67 ms
73,256 KB
testcase_15 AC 69 ms
73,256 KB
testcase_16 AC 67 ms
73,256 KB
testcase_17 AC 84 ms
75,764 KB
testcase_18 AC 95 ms
75,624 KB
testcase_19 AC 91 ms
75,624 KB
testcase_20 AC 145 ms
76,176 KB
testcase_21 AC 154 ms
76,176 KB
testcase_22 AC 136 ms
76,176 KB
testcase_23 AC 97 ms
75,624 KB
testcase_24 AC 94 ms
75,752 KB
testcase_25 AC 64 ms
68,652 KB
testcase_26 AC 178 ms
76,176 KB
testcase_27 AC 145 ms
76,416 KB
testcase_28 AC 64 ms
69,172 KB
testcase_29 AC 178 ms
76,360 KB
testcase_30 AC 105 ms
76,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
A=max(a)
g=0
for k in range(1,A):
	q=[[0]*(A+1) for _ in range(3)]
	for i in range(n):
		if a[i]-k-1>=0:
			g+=q[2][a[i]-k-1]
		if a[i]+k<=A:
			q[2][a[i]]+=q[1][a[i]+k]
		if a[i]-k-10>=0:
			q[1][a[i]]+=q[0][a[i]-k-10]
		q[0][a[i]]+=1
print(g)
0