No.2055 12x34...
レベル :
/ AI推定難易度 : 1000
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 106
作問者 :
PCTprobability
/ テスター :
butsurizuki
タグ : / 解いたユーザー数 106
作問者 :
PCTprobability
/ テスター :
butsurizuki
問題文最終更新日: 2022-08-20 22:51:13
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
NPCA 合宿コンテスト
(順位表)
の他の問題:
Problem Statement
You are given a sequence of $N$ positive integers $A_1,A_2,\dots,A_N$.
Among the subsequences of $A$ (not necessarily contiguous) of length at least $2$, find the number of those that are arithmetic progressions with common difference $1$, modulo $998244353$.
Constraints
- $2 \le N \le 2 \times 10^5$
- $1 \le A_i \le 10^9$
- All input values are integers.
Input
$N$ $A_1$ $A_2$ $\dots$ $A_N$
Output
Output the answer.
Sample
Sample 1
Input
6 1 2 3 2 4 1
Output
7
There are $7$ such subsequences: $(A_1,A_2),(A_1,A_2,A_3),(A_1,A_2,A_3,A_5),(A_1,A_4),(A_2,A_3),(A_2,A_3,A_5),(A_3,A_5)$.
Sample 2
Input
10 1 2 3 4 5 6 7 8 9 10
Output
45
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。