[PA 2008] Cliquers

Luogu
IDLGP10613
Time1000ms
Memory512MB
DifficultyP6
动态规划 DP2008O2优化背包 DP根号分治PA(波兰)
统计结点个数为 $n$,且每一个连通分量都是完全图的本质不同的图的个数 $x$。 求 $m^x \bmod P$,其中 $P=10^9-401$ 为一个质数。 ## Input 一行两个整数,分别为 $n,m$。 ## Output 一行一个整数,表示所求的结果。 [samples] ## Note **【样例解释】** 当 $n=3$ 时,$3$ 种情况如下图所示。注意您应当输出的是 $m^x \bmod P=2^3 \bmod (10^9-401)$ 的值。 ![](https://cdn.luogu.com.cn/upload/image_hosting/oeqoqluo.png) **【数据范围】** 对于所有数据,$1\leq n,m\leq 2\times 10^5$。
Samples
Input #1
3 2
Output #1
8
API Response (JSON)
{
  "problem": {
    "name": "[PA 2008] Cliquers",
    "description": {
      "content": "统计结点个数为 $n$,且每一个连通分量都是完全图的本质不同的图的个数 $x$。 求 $m^x \\bmod P$,其中 $P=10^9-401$ 为一个质数。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 524288
    },
    "difficulty": {
      "LuoguStyle": "P6"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGP10613"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "统计结点个数为 $n$,且每一个连通分量都是完全图的本质不同的图的个数 $x$。\n\n求 $m^x \\bmod P$,其中 $P=10^9-401$ 为一个质数。\n\n## Input\n\n一行两个整数,分别为 $n,m$。\n\n## Output\n\n一行一个整数,表示所求的结果。\n\n[samples]\n\n## Note\n\n**【样例解释】**\n\n当 $n=3$ 时,$3$ 种情况如下图所示。注意您应当输...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments