当前位置: 首页 > news >正文

UNIQUE VISION Programming Contest 2025 Autumn (AtCoder Beginner Contest 425)

E - Count Sequences 2

不能线性求逆元,模数不一定是素数
用C(n,m) = C(n-1,m-1)+C(n-1,m)预处理组合数

#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define pii pair<int,int>
#define ll long long
#define pb push_back
#define ft first
#define se second
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f// #define int long longint p;
int c[300010];
int C[5010][5010];void solve(){int n; cin >> n; int s = 0;for(int i = 1; i <= n; i ++){cin >> c[i]; s += c[i];} int cur = s; int ans = 1;for(int i = 1; i <= n; i ++){ans = 1ll*ans * C[cur][c[i]] % p;cur -= c[i];}cout << ans << '\n';}signed main(){std::ios::sync_with_stdio(false);int T = 1; cin >> T >> p;C[0][0] = 1;for(int i = 1; i <= 5000; i ++){for(int j = 0; j <= i; j ++){if(j == 0 || j == i) {C[i][j] = 1;continue;}C[i][j] = (C[i - 1][j] + C[i - 1][j - 1])%p;}}while(T--){solve();}
}

F - Inserting Process

n20左右状压

#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define pii pair<int,int>
#define ll long long
#define pb push_back
#define ft first
#define se second
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f// #define int long longconst int p = 998244353;
int f[(1<<22) + 10];
void solve(){int n; cin >> n;string s; cin >> s;f[0] = 1;for(int i = 1; i < (1ll << n); i ++) {char lst = ' ';for(int j = 0; j < n; j ++){if(i >> j & 1){if(lst == s[j]) continue;lst = s[j];f[i] = (f[i] + f[i ^ (1ll << j)]) % p;}}}cout << f[(1ll << n) - 1] << '\n';}signed main(){std::ios::sync_with_stdio(false);int T = 1; //cin >> T;while(T--){solve();}
}
http://www.jsqmd.com/news/139211/

相关文章:

  • 泰山派如何编译SDK并烧录
  • P7213 [JOISC 2020] 最古の遺跡 3
  • 亚马逊电商产品智能定价数据集-75000条多维度产品信息-包含文本描述与图片链接-支持机器学习价格预测模型训练与电商定价策略优化-非结构化的产品描述文本和视觉图像数据
  • 2025 年上海夹爪品牌哪家值得选?行业人实测推荐 - 品牌2025
  • 警惕大数据处理中的“检查者悖论”
  • 2025年汽车海外营销推广服务商TOP5推荐(12月更新):Facebook、LinkedIn、TikTok、Google、INS等全平台覆盖 - 品牌2026
  • 函数导数概念的图形解释 | JsxGraph 课件
  • 2025年优质面粉机公司推荐:深挖小型面粉机/大型面粉机/石磨面粉机/中型面粉机/杂粮面粉机厂家+ 低能耗企业全解析! - 海棠依旧大
  • 2025全域GEO优化服务商精选:以精准适配解锁商业增长新入口 - 品牌推荐排行榜
  • 禅道--使用
  • 2025年优质排针推荐厂商排名:排针按需定制与来样定制专业企业全解析 - myqiye
  • 告别“等、靠、要”:业务人员自助数据分析的入门指南
  • 2025北京岩板定制厂家TOP5权威推荐:五方岩板厂专业吗? - myqiye
  • 2025年专业精密机械零件代加工厂家权威推荐榜单:制造加工机械/机械加工/数控机械加工源头厂家精选 - 品牌推荐官
  • Open-AutoGLM实战指南(从原理到部署的完整路径图谱)
  • 三氮唑原料靠谱厂家推荐 - 真知灼见33
  • 2025年电线电缆厂家推荐排行榜:电线电缆老牌厂家与按需定制服务测评 - 工业推荐榜
  • Open-AutoGLM接口调用全解析,彻底解决模型延迟与超时问题
  • 离线部署Open-AutoGLM实战手册(从环境搭建到推理验证)
  • 收藏!普通Python开发程序员转型大模型方向全攻略
  • NeurIPS | 别直接训!给主模型加个错题本,6B轻松超越8B
  • 2025年终宜昌旅游项目推荐:主流项目横向对比与高满意度三强盘点。 - 品牌推荐
  • 大模型部署革命:Cornserve实现Any-to-Any模型3.81倍性能提升(值得收藏)
  • 2025净化工程等级与行业匹配关系、承建及总包公司TOP5权威推荐 - 工业品牌热点
  • 将流对象重新封装成一个List集合
  • 为什么顶尖AI团队都在转向Open-AutoGLM?背后有这6个技术真相
  • 当AI遇上数据库:为何初创公司,都选了那个“老派”的PG
  • 【Open-AutoGLM入门到精通】:掌握自动推理与模型压缩的终极武器
  • 单北斗GNSS桥梁变形监测系统的应用与发展解析
  • 2025年终三峡旅游路线推荐:聚焦短途与深度游的3强口碑榜单解析。 - 品牌推荐