当前位置:网站首页>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 to Integrate Your Service Registry with Istio?
- Towhee 每周模型
- Qt实战案例(56)——利用QProcess实现应用程序重启功能
- Six Stones Programming: Problems must be faced, methods must be skillful, and functions that cannot be done well must be solved
- 8. SAP ABAP OData 服务如何支持创建(Create)操作
- opencv 保存图片imwrite
- 关于Request复用的那点破事儿。研究明白了,给你汇报一下。
- [LiteratureReview]Optimal and Robust Category-level Perception: Object Pose and Shape Estimation f
- 批量任务导入到数据库中
猜你喜欢

关于Request复用的那点破事儿。研究明白了,给你汇报一下。

HMS Core音频编辑服务音源分离与空间音频渲染,助力快速进入3D音频的世界

树和二叉树的转换
![leetcode: 1201. Ugly Number III [Dichotomy + Mathematics + Inclusion and Exclusion Principle]](/img/44/bf1d9b9d85939e73bc44be2f9701e1.png)
leetcode: 1201. Ugly Number III [Dichotomy + Mathematics + Inclusion and Exclusion Principle]

【无标题】

RGB系列开发稳定响应快速灯带拾音灯氛围灯等应用定制方案

Data Mining-04

AD单片机九齐单片机NY8B062D SOP16九齐

PAT 1162 Postfix Expression(25)

华盛顿大学、Allen AI 等联合 | RealTime QA: What's the Answer Right Now?(实时 QA:现在的答案是什么?)
随机推荐
sql中常用到的正则表达
iframe标签属性说明 详解[通俗易懂]
预防和制止家庭暴力 人身安全保护令司法解释今起施行
How does the SAP ABAP OData service support the Create operation trial version
[深入研究4G/5G/6G专题-47]: 5G Link Adaption链路自适应-3-下行链路自适应DLLA-PDSCH信道
formatdatetime function mysql (date sub function)
PIR人体感应AC系列感应器投光灯人体感应开关等应用定制方案
什么是一致性哈希?可以应用在哪些场景?
论文笔记All about Eve: Execute-Verify Replication for Multi-Core Servers
PanGu-Coder:函数级的代码生成模型
消息中间件解析 | 如何正确理解软件应用系统中关于系统通信的那些事?
iframe tag attribute description detailed [easy to understand]
postgresql之page分配管理(一)
Multithreading Case - Timer
2022-07-25 网工进阶(二十一)BGP-路由反射器、联盟、聚合
Towhee 每周模型
如何使用OpenCV测量图像中物体之间的距离
What Can Service Mesh Learn from SDN?
34、树莓派进行人体姿态检测并进行语音播报
kubernetes之DaemonSet以及滚动更新