No.3645 Count Shitoshitoto Sequence
レベル :
/ AI推定難易度 : 130
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 1024 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 40
作問者 :
kazuppa
/ テスター :
Tamiji153
Unbakedbread
タグ : / 解いたユーザー数 40
作問者 :
kazuppa
/ テスター :
問題文最終更新日: 2026-08-25 18:38:39
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
Paken新入生コンday2
(順位表)
の他の問題:
Problem Statement
A sequence $X$ satisfying the following conditions is called a Shitoshitoto sequence.
- $|X|=5$
- $X_1=X_3$
- $X_2=X_4=X_5$
- $X_1\neq X_2$
You are given a positive integer $N$. Among the integer sequences $X$ whose elements are all between $1$ and $N$, inclusive, find the number of Shitoshitoto sequences, modulo $998244353$.
Constraints
- $1\leq N\leq 10^6$
- $N$ is an integer.
Subtasks
This problem has partial scoring by subtasks.
| Subtask | Score | Constraints |
|---|---|---|
| Subtask 1 | 10 % | $N\leq 2$ |
| Subtask 2 | 30 % | $N \le 30$ |
| Subtask 3 | 60 % | No additional constraints |
Input
$N$
Output
Print the answer on a single line.
Sample
Sample 1
Input
3
Output
6
For example, $X=(3,2,3,2,2)$ and $X=(1,2,1,2,2)$ satisfy the conditions.
There are $6$ sequences $X$ satisfying the conditions in total, so print $6$.
Sample 2
Input
1
Output
0
No sequence satisfies the conditions.
Sample 3
Input
169231
Output
688120246
Note that the answer must be printed modulo $998244353$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。