No.2733 Just K-times TSP
レベル :
/ AI推定難易度 : 1250
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 90
作問者 :
hiro1729
/ テスター :
👑
AngrySadEight
kusirakusira
FplusFplusF
みどりむし🦠
タグ : / 解いたユーザー数 90
作問者 :
kusirakusira
FplusFplusF
みどりむし🦠
問題文最終更新日: 2024-09-21 18:49:28
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 428
(順位表)
の他の問題:
Problem Statement
You are given a simple undirected graph with $N$ vertices and $M$ edges, and a positive integer $K$. The vertices are numbered from $1$ to $N$ and the edges are numbered from $1$ to $M$. Edge $i (1 \le i \le M)$ connects vertices $u_i$ and $v_i$.
Find the number of walks on this graph that satisfy the following condition, and print the count modulo $998244353$.
- For every $i \ (i=1, \ldots, N)$, vertex $i$ is used exactly $K$ times.
What is a walk?
A walk on a graph $G$ is a sequence $(v_1, e_1, v_2, \ldots, v_{k-1}, e_{k-1}, v_k)$ alternating $k$ vertices ($k$ is a positive integer) and $k-1$ edges, such that edge $e_i$ connects vertices $v_i$ and $v_{i+1}$.Constraints
- $1 \le N \le 6$
- $0 \le M \le \frac{N (N - 1)}{2}$
- $1 \le K \le 8$
- $1 \le u_i < v_i \le N (1 \le i \le M)$
- $ (u_i, v_i) \ne (u_j, v_j) (1 \le i < j \le M)$
- All input values are integers.
Input
The input is given from standard input in the following format.
$N \ M \ K$ $u_1 \ v_1$ $\vdots $ $u_M \ v_M$
Output
Output the number of walks satisfying the condition modulo $998244353$, followed by a newline.
Sample
Sample 1
Input
4 4 2 1 2 1 3 3 4 2 3
Output
6
Denoting a move from edge $i$ to edge $j$ as $i→j$, there are the following $6$ walks.
- $1→2→1→2→3→4→3→4$
- $2→1→2→1→3→4→3→4$
- $4→3→1→2→1→2→3→4$
- $4→3→2→1→2→1→3→4$
- $4→3→4→3→1→2→1→2$
- $4→3→4→3→2→1→2→1$
Sample 2
Input
3 3 4 1 2 2 3 1 3
Output
1092
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。