C. Binary Craziness

    传统题 1000ms 256MiB

Binary Craziness

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Description

Walk Alone has a graph of nn nodes and mm bi-directional edges. He defines a function of $f(u, v)=(\deg_u \oplus \deg_v)(\deg_u | \deg_v)(\deg_u \& \deg_v)$, where degu{\rm deg}_u denotes the number of edges that associated with node uu, and ,,&\oplus, |, \& denotes bitwise xor, bitwise or and bitwise and. He wants you to calculate $\left(\sum_{i=1}^n \sum_{j=i}^n f(i, j)\right) \bmod 998\ 244\ 353$.

Format

Input

The first line of the input contains two integers n,mn, m (1n106,0m1061\le n\le 10^6, 0 \le m \le 10^6) denoting the number of nodes and edges.

Each of the following mm lines contains two integers u,vu, v (1u,vn1 \le u, v \le n) representing a bi-directional edge (u,v)(u, v).

The graph might have duplicated edges and self-loops. Remind that a self-loop on node xx will contribute 22 to degx\deg_x.

Output

Output a single integer denoting the answer.

Samples

6 6
1 3
2 3
1 4
2 5
3 6
4 6

30

Limitation

1s, 1024KiB for each test case.

2026 SYNU 五月周赛 Round I (Div 3)

未参加
状态
已结束
规则
XCPC
题目
4
开始于
2026-5-7 19:30
结束于
2026-5-7 21:00
持续时间
1.5 小时
主持人
参赛人数
14