当前位置:网站首页>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);
}
边栏推荐
- 透过开发抽奖小程序,体会创新与迭代
- VINS-mono 论文解读:IMU预积分+Marg边缘化
- ECCV 2022|R2L: 用数据蒸馏加速NeRF
- 如何降低Istio服务网格中Envoy的内存开销
- Multithreading Case - Timer
- 多线程案例——阻塞式队列
- 微信UI在线聊天源码 聊天系统PHP采用 PHP 编写的聊天软件,简直就是一个完整的迷你版微信
- JMP Pro 16.0 software installation package download and installation tutorial
- Why does the maximum plus one equal the minimum
- PIR人体感应AC系列感应器投光灯人体感应开关等应用定制方案
猜你喜欢
50W+小程序开发者背后的数据库降本增效实践
iPhone难卖,被欧洲反垄断的服务业务也难赚钱了,苹果的日子艰难
「计算复杂性」理论奠基人Juris Hartmanis逝世,曾获93年图灵奖
HMS Core音频编辑服务音源分离与空间音频渲染,助力快速进入3D音频的世界
gpio模拟串口通信
NebulaGraph v3.2.0 Performance Report
芝加哥丰田技术学院 | Leveraging Natural Supervision for Language Representation Learning and Generation(利用自然监督进行语言表示学习和生成)
华盛顿大学、Allen AI 等联合 | RealTime QA: What's the Answer Right Now?(实时 QA:现在的答案是什么?)
Data Mining-04
台积电认清了形势,新的建厂计划没有美国,中国芯片也得到重视
随机推荐
lua脚本关键
【5GC】5G网络切片与5G QoS的区别?
8. SAP ABAP OData 服务如何支持创建(Create)操作
leetcode:1201. 丑数 III【二分 + 数学 + 容斥原理】
ABC260 E - At Least One(双指针)
PAT 1163 Dijkstra Sequence(30)
线上问题排查常用命令,总结太全了,建议收藏!!
微服务原生案例搭建
NebulaGraph v3.2.0 Performance Report
论文笔记All about Eve: Execute-Verify Replication for Multi-Core Servers
How does the SAP ABAP OData service support the Create operation trial version
PAT 1167 Cartesian Tree(30)
AI目标分割能力,无需绿幕即可实现快速视频抠图
Towhee 每周模型
kubernetes之DaemonSet以及滚动更新
【每日一题】593. 有效的正方形
魔众文档管理系统 v5.0.0
HMS Core音频编辑服务音源分离与空间音频渲染,助力快速进入3D音频的世界
iframe标签属性说明 详解[通俗易懂]
gpio模拟串口通信