結果
問題 | No.2374 ASKT Subsequences |
ユーザー |
|
提出日時 | 2023-07-07 22:09:27 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 195 ms / 2,000 ms |
コード長 | 732 bytes |
コンパイル時間 | 294 ms |
コンパイル使用メモリ | 81,832 KB |
実行使用メモリ | 108,416 KB |
最終ジャッジ日時 | 2024-07-21 18:11:58 |
合計ジャッジ時間 | 4,202 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
import syssys.setrecursionlimit(5*10**5)input = sys.stdin.readlinefrom collections import defaultdict, deque, Counterfrom heapq import heappop, heappushfrom bisect import bisect_left, bisect_rightfrom math import gcdn = int(input())a = list(map(int,input().split()))cnt = [[0]*(n) for i in range(2010)]for i in range(n):cnt[a[i]][i] = 1for i in range(2010):for j in range(1,n):cnt[i][j] += cnt[i][j-1]ans = 0for a2 in range(1, n):for a3 in range(a2+1, n-1):k = a[a2] - a[a3]if k <= 0: continuea1 = a[a3] - 10a4 = a[a2] + 1if not(1<= a1 <= 2000 and 1<= a4 <= 2000): continueans += cnt[a1][a2-1] * (cnt[a4][-1] - cnt[a4][a3])print(ans)