新闻详情

新闻详情

首页 / 资讯中心 / 详情

2026-09-29 hetao1733837 的刷题记录

发布时间:2026/9/30 4:57:02来源:尧图网络
2026-09-29 hetao1733837 的刷题记录
AT_abc477_f [ABC477F] Count Cells in a Window原题链接[ABC477F] Count Cells in a Window分析一眼秒的扫描线……扫描线的本质还是枚举一个另外一个直接扔到线段树上当然本题可以写树状数组……正解#includebits/stdc.h#defineintlonglongusingnamespacestd;constintN200005;intn,m,q;structcol{intid;intl,r;}a[N];inttot;structask{intid,l,r,val;}b[N2];booloperator(constasktmp1,constasktmp2){returntmp1.ltmp2.l;}structBIT{intc[N];voidadd(intx,intval){for(intix;im;ii(-i))c[i]val;}intquery(intx){intres0;for(intix;i;i-i(-i))resc[i];returnres;}}T1,T2;voidmodify(intl,intr,intval){T1.add(l,val);T1.add(r1,-val);T2.add(l,val*l);T2.add(r1,-val*(r1));}intquery(intx){return(x1)*T1.query(x)-T2.query(x);}intans[N];signedmain(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cinnmq;for(inti1;in;i){cina[i].la[i].r;a[i].idi;}for(inti1,A,B,C,D;iq;i){cinABCD;b[tot]{i,B,D,1};b[tot]{i,A-1,D,-1};b[tot]{i,B,C-1,-1};b[tot]{i,A-1,C-1,1};}sort(b1,btot1);intcur0;for(inti1;itot;i){while(curb[i].l){cur;modify(a[cur].l,a[cur].r,1);}if(b[i].r0b[i].l0){ans[b[i].id]b[i].val*query(b[i].r);}}for(inti1;iq;i){coutans[i]\n;}}AT_arc156_b [ARC156B] Mex on Blackboard原题链接[ARC156B] Mex on Blackboard分析从某些角度而言我们需要知道a aa序列的所有子序列可以组成多少mex ⁡ \operatorname{mex}mex假设这个个数是c n t cntcnt那么答案似乎就是c n t k cnt^kcntk那么前一个怎么求呢排序是必要的……然后a i ≤ 2 × 10 5 a_i\le 2\times 10^5ai​≤2×105直接遍历似乎就可以了这么容易不不不你会发现我们每次都会把新的mex ⁡ \operatorname{mex}mex加进去。那我似乎可以进行DP了我们设d p k k , m e x dp_{kk,mex}dpkk,mex​表示我们现在进行到了第k k kkkk轮这一轮我们要往黑板上写的是m e x mexmex的方案数……转移类似于从前一个转移而且要把这次选满复杂度估计不低于O ( n 3 ) O(n^3)O(n3)。那咋做啊我们发现其实是另外一个分支我们发现如果现在写的是x xx且x xx是出现过的最大的那么我们需要把[ 0 , x ] [0,x][0,x]全都写上。假设我们需要c n t cntcnt次才能将其全部写上那么还剩下k − c n t k-cntk−cnt次。那么这个的方案数就是C k − c n t x x C_{k-cntx}^{x}Ck−cntxx​。我们枚举值域即可。正解#includebits/stdc.h#defineintlonglong#definemod998244353usingnamespacestd;constintN1000005;intn,k,a[N];intfac[N],inv[N];intqpow(inta,intb){intres1;while(b){if(b1)resres*a%mod;aa*a%mod;b1;}returnres;}intC(intn,intm){if(n0||m0||nm)return0;returnfac[n]*inv[n-m]%mod*inv[m]%mod;}intvis[N];signedmain(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cinnk;for(inti1;in;i){cina[i];vis[a[i]];}fac[0]1;for(inti1;iN;i){fac[i]fac[i-1]*i%mod;}inv[N-1]qpow(fac[N-1],mod-2);for(intiN-2;i0;i--){inv[i]inv[i1]*(i1)%mod;}intans0,cnt0;for(inti0;iN-5;i){if(!vis[i])cnt;if(vis[i1])continue;if(cntk)break;ans(ansC(k-cnti,i))%mod;}coutans;}凭啥这个能过
网站建设高端定制企业官网
RELATED

相关资讯

更多精彩内容,欢迎继续阅读

较早相关资讯

最新相关资讯

AWS Auto Scaling Groups 实战入门:用 devops-exercises 从零搭建弹性 Web 集群 2026/9/30 7:04:25

AWS Auto Scaling Groups 实战入门:用 devops-exercises 从零搭建弹性 Web 集群

文档教程DevOps运维 【免费下载链接】devops-exercises Linux, Jenkins, AWS, SRE, Prometheus, Docker, Python, Ansible, Git, Kubernetes, Terraform, OpenStack, SQL, NoSQL, Azure, GCP, DNS, Elastic, Network, Virtualization. DevOps Interview Questions 项目地址&…

阅读更多 →
滞后特征与时间切分:Beginner-Data-Science-Projects时间序列预测如何避免数据泄露 2026/9/30 7:04:25

滞后特征与时间切分:Beginner-Data-Science-Projects时间序列预测如何避免数据泄露

滞后特征与时间切分:Beginner-Data-Science-Projects时间序列预测如何避免数据泄露 【免费下载链接】Beginner-Data-Science-Projects This repository is a curated collection of hands-on data science projects tailored for beginners. Whether youre just sta…

阅读更多 →
米家设备接入 Home Assistant:ha_xiaomi_home 三种安装方式与本地控制实操 2026/9/30 7:04:11

米家设备接入 Home Assistant:ha_xiaomi_home 三种安装方式与本地控制实操

米家设备接入 Home Assistant:ha_xiaomi_home 三种安装方式与本地控制实操 【免费下载链接】ha_xiaomi_home Xiaomi Home Integration for Home Assistant 项目地址: https://gitcode.com/GitHub_Trending/ha/ha_xiaomi_home ha_xiaomi_home(Xiao…

阅读更多 →
HelloGitHub 第 44 期月刊精读:34 个入门级开源项目的实用指南 2026/9/30 7:04:05

HelloGitHub 第 44 期月刊精读:34 个入门级开源项目的实用指南

技术博客文档知识库 【免费下载链接】HelloGitHub :octocat: 分享 GitHub 上有趣、入门级的开源项目。Share interesting, entry-level open source projects on GitHub. 项目地址: https://gitcode.com/GitHub_Trending/he/HelloGitHub 点击查看 免费下载 本文以 …

阅读更多 →
ERPNext GL Entry 详解:总账分录如何聚合全部会计记录并驱动财务报表 2026/9/30 7:04:05

ERPNext GL Entry 详解:总账分录如何聚合全部会计记录并驱动财务报表

后端企业应用 【免费下载链接】erpnext Free and Open Source Enterprise Resource Planning (ERP) 项目地址: https://gitcode.com/GitHub_Trending/er/erpnext 点击查看 免费下载 导读 GL Entry(General Ledger Entry,总账分录&#xff0…

阅读更多 →
Data Engineer Handbook 第四周实战:状态变化追踪、GROUPING SETS 与窗口函数三种分析模式全解 2026/9/30 7:04:05

Data Engineer Handbook 第四周实战:状态变化追踪、GROUPING SETS 与窗口函数三种分析模式全解

数据工程文档教程 【免费下载链接】data-engineer-handbook This is a repo with links to everything youd ever want to learn about data engineering 项目地址: https://gitcode.com/GitHub_Trending/da/data-engineer-handbook 点击查看 免费下载 本篇技术指南…

阅读更多 →

今日资讯

本周资讯

本月资讯

看完文章仍有疑问?

联系尧图顾问,获取一对一建站咨询

立即免费咨询 📞 400-888-8888
📞 ✉