QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 512 MB Total points: 100 Hackable ✓

#17366. 广义串并联图计数

Statistics

广义串并联图计数

  • 时间限制:$2$ 秒
  • 空间限制:$512 \text{ MB}$

题目描述

定义一张 有标号 无向图是简单广义串并联图,当且仅当:

  1. 图联通;
  2. 图上 不存在 重边和自环;
  3. 对于任意 $4$ 个节点都 不存在 $6$ 条两两没有公共点的路径连接这 $4$ 个节点中的每一对节点。

定义 $f(i,j)$ 表示有多少张 $i$ 个点 $j$ 条边的简单广义串并联图。

给定 $n,m,p$,你需要求出所有 $1 \leq i \leq n,1 \leq j \leq m$ 的 $f(i,j) \bmod p$ 的结果。

输入格式

共一行,包含三个正整数 $n,m,p$。

输出格式

输出 $n$ 行,每行包含 $m$ 个整数,其中第 $i$ 行的第 $j$ 个整数表示 $f(i,j) \bmod p$ 的结果。

样例 1 输入

5 10 998244353

样例 1 输出

0 0 0 0 0 0 0 0 0 0 
1 0 0 0 0 0 0 0 0 0 
0 3 1 0 0 0 0 0 0 0 
0 0 16 15 6 0 0 0 0 0 
0 0 0 125 222 205 70 0 0 0

样例 2

见附加文件。

数据范围

对于所有数据,保证:

  • $1\le n,m \le 50$;
  • $10^8 \le p \le 10^9+7$,$p$ 是质数。

本题采用捆绑测试

  • Subtask 1(8 points):$n \le 8$,$m \le 10$。
  • Subtask 2(12 points):$n \le 10$,$m \le 20$。
  • Subtask 3(12 points):$n \le 11$,$m \le 20$。
  • Subtask 4(32 points):$n,m\le25$。
  • Subtask 5(36 points):无特殊限制。

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#1562EditorialOpen题解ucup-team78702026-04-17 22:47:03View
#1564Editorial OpenNew Editorial for Problem #17366ChiFAN2026-04-17 22:42:28 Download

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.