問題一覧 > 通常問題

No.2985 May Count Induced C4 Subgraphs

レベル : / AI推定難易度 : 2700 / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / スペシャルジャッジ問題 (複数の解が存在する可能性があります)
タグ : (AC するまで非表示) / 解いたユーザー数 12
作問者 : 👑 Nachia
お気に入りにしたユーザー ProblemId : 11692 / 自分の提出
問題文最終更新日: 2024-12-09 02:33:59
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
Advent Calendar Contest 2024 (順位表) の他の問題:

Note

The time limit is $5$ seconds, but it is quite tight.

Problem Statement

Freely choose a non-negative integer $T$ ( $0\leq T\leq 998\, 244\, 352$ ) and solve the following problem.


You are given an undirected simple graph with $N$ vertices and $M$ edges. The vertices and the edges are each numbered in order starting from $1$. The $i$-th edge connects vertices $U_i$ and $V_i$.

Among the ways to choose $4$ vertices of this graph, consider the induced subgraph on the chosen vertices, and let

  • $A$ be the number of ways whose induced subgraph has no edges, and
  • $B$ be the number of ways whose induced subgraph has exactly $4$ edges that form a cycle of length $4$.

Find $A+TB$ modulo $998\, 244\, 353$.

Constraints

  • $1\leq N\leq 2\times 10^5$
  • $0\leq M\leq 2\times 10^5$
  • $U_i \neq V_i$
  • If $i\neq j$, then $\lbrace U_i,V_i\rbrace \neq \lbrace U_j,V_j\rbrace$
  • All input values are integers.

Input

$N$ $M$
$U_1$ $V_1$
$U_2$ $V_2$
$\vdots$
$U_M$ $V_M$

Output

Output the value of $T$ and the remainder of $A+TB$ divided by $998\, 244\, 353$, in this order, separated by a space, on $1$ line. End the output with a newline.

Sample

Sample 1
Input
6 4
1 2
2 3
3 4
4 1
Output
10000 20001

The induced subgraphs with no edges, written as vertex sets, are the following $2$: $\lbrace 1,3,5,6\rbrace , \lbrace 2,4,5,6\rbrace$.

The induced subgraphs with exactly $4$ edges that form a cycle of length $4$, written as vertex sets, are the following $1$: $\lbrace 1,2,3,4\rbrace$.

Since $A=2$ , $B=1$ , the answer when choosing $T=10000$ is $2\times 10000 + 1=20001$.

Sample 2
Input
3 3
1 2
2 3
1 3
Output
99999 0

We have $A=B=0$.

Sample 3
Input
10 17
1 4
1 6
1 10
3 4
3 5
4 5
4 6
4 9
4 10
5 7
5 8
5 9
6 8
6 10
7 9
7 10
9 10
Output
0 13

We have $A=13$ , $B=2$.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。