当前位置:网站首页>E - Red and Blue Graph (Combinatorics)
E - Red and Blue Graph (Combinatorics)
2022-08-01 13:45:00 【Harris-H】
E - Red and Blue Graph(组合数学)
Because it requires an even number of edges of different colors.
Note the number of edges of different colors as x x x,The number of edges that are all red in color is y y y.
Then the sum of the degrees of red points is : 2 y + x = s 2y+x=s 2y+x=s
即 x , s x,s x,s 奇偶性相同.
而 s s s 的奇偶性,Only depends on the number of red dots with odd degrees.
Therefore, it is enough to enumerate the number of odd degrees in the red point,The rest are chosen in degrees is even.
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const int N=2e5+10;
const ll mod=998244353;
int n,m,k,d[N],num[2];ll inv[N],fac[N],ans;
ll C(int n,int m)
{
if(n<m||m<0) return 0ll;
return fac[n]*inv[m]%mod*inv[n-m]%mod;
}
int main()
{
scanf("%d %d %d",&n,&m,&k);
for(int i=1,u,v;i<=m;i++)
scanf("%d %d",&u,&v),d[u]++,d[v]++;
fac[0]=inv[1]=inv[0]=1;
for(int i=1;i<=n;i++) fac[i]=fac[i-1]*i%mod;
for(int i=2;i<=n;i++) inv[i]=(mod-mod/i)*inv[mod%i]%mod;
for(int i=2;i<=n;i++) inv[i]=inv[i]*inv[i-1]%mod;
for(int i=1;i<=n;i++)
num[d[i]&1]++;
for(int i=0;i<=num[1];i+=2) //The number of odd degrees must be even
ans=(ans+C(num[1],i)*C(num[0],k-i))%mod;
printf("%lld",ans);
}
边栏推荐
猜你喜欢
How does the SAP ABAP OData service support the Create operation trial version
论文笔记All about Eve: Execute-Verify Replication for Multi-Core Servers
什么是元编程
热心肠:关于肠道菌群和益生菌的10个观点
消息中间件解析 | 如何正确理解软件应用系统中关于系统通信的那些事?
易优压双驱挖掘机压路机器类网站源码 v1.5.8
「计算复杂性」理论奠基人Juris Hartmanis逝世,曾获93年图灵奖
台积电认清了形势,新的建厂计划没有美国,中国芯片也得到重视
PyTorch 进阶之路:在 GPU 上训练深度神经网络
【码蹄集新手村600题】判断一个数字是否为完全平方数
随机推荐
LeetCode_动态规划_中等_313.超级丑数
程序员的浪漫七夕
Gradle series - Gradle tests, Gradle life cycle, settings.gradle description, Gradle tasks (based on Groovy documentation 4.0.4) day2-3
Qt实战案例(55)——利用QDir删除选定文件目录下的空文件夹
人像分割技术解析与应用
硬链接、软连接浅析
高仿项目协作工具【Worktile】,从零带你一步步实现组织架构、网盘、消息、项目、审批等功能
JMP Pro 16.0软件安装包下载及安装教程
让程序员早点下班的效率工具
AtCoder Beginner Contest 261 D - Flipping and Bonus
高仿项目协作工具【Worktile】,从零带你一步步实现组织架构、网盘、消息、项目、审批等功能
响应式2022英文企业官网源码,感觉挺有创意的
Based on 10 years of experience in stability assurance, what are the three key questions to be answered in failure recovery?|TakinTalks big coffee sharing
28uA待机8米距离低压保护单片机探头太阳能灯人体PIR定制方案
OpenSSL SSL_read: Connection was reset, errno 10054
uniapp读取和写入文件
批量替换Word中的表格为图片并保存
RGB系列开发稳定响应快速灯带拾音灯氛围灯等应用定制方案
消息中间件解析 | 如何正确理解软件应用系统中关于系统通信的那些事?
D - I Hate Non-integer Number(背包dp)