No.3574 Sum of Mex
レベル :
/ AI推定難易度 : 2225
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 1024 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 13
作問者 :
wasab1
/ テスター :
butsurizuki
タグ : / 解いたユーザー数 13
作問者 :
butsurizuki
問題文最終更新日: 2026-06-20 18:27:36
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
yukicoder contest 502
(順位表)
の他の問題:
Problem Statement
You are given a positive integer $N$. For sequences $A=(A_0,A_1,\cdots,A_{N-1}),B=(B_0,B_1,\cdots,B_{N-1})$ of length $N$ whose every term is at least $0$ and less than $N$, their score is defined as follows:
- $\mathrm{mex}(C)$, where the sequence $C=(C_0,C_1,\cdots,C_{N-1})$ of length $N$ is defined by $C_i=A_{B_i}$
Input
$N$
- $1\leq N\leq10^6$
Output
Output the sum of the scores over all pairs $(A,B)$, modulo the prime $998244353$. Print a newline at the end.
Sample
Sample 1
Input
5
Output
8412245
Sample 2
Input
10000
Output
40963056
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。