首页 > 其他分享 >CF1744F MEX vs MED

CF1744F MEX vs MED

时间:2023-02-24 21:11:19浏览次数:32  
标签:MED CF1744F 计算长度 times vs MEX

个人思路:
条件可以转化成长度为 \(x\) 的区间需要包含 \([0,\lfloor \frac{(x-1)}{2} \rfloor]\)。
我们从小到大枚举每一个数 \(i\),计算长度为 \(i \times 2 + 1\) 和 \(i \times 2 + 2\) 的区间个数。
我们维护一下 \([0,i]\) 的中最靠左的位置和最靠右的位置,然后计算答案。

标签:MED,CF1744F,计算长度,times,vs,MEX
From: https://www.cnblogs.com/Mysterious-Cat/p/17153136.html

相关文章

  • 417. Pacific Atlantic Water Flow[Medium]
    417.PacificAtlanticWaterFlowThereisanmxnrectangularislandthatbordersboththePacificOceanandAtlanticOcean.ThePacificOceantouchestheisl......
  • win11_安装VScommunity|CUDA|pytorch
    注意:安装cuda过程中,有一步会检查是否安装了VisualStudio,所以本文中先安装VisualStudio,再安装cuda。参考:https://blog.csdn.net/weixin_44019018/article/details/122052......
  • VS Code下载安装使用教程
    VSCode下载安装使用教程@目录VSCode下载安装使用教程一、下载二、安装三、使用教程3.1VSCode中的第一个页面HelloWorld.html3.2VSCode插件安装(黑马程序员)3.2.1安装......
  • 133. Clone Graph[Medium]
    133.CloneGraphGivenareferenceofanodeinaconnectedundirectedgraph.Returnadeepcopy(clone)ofthegraph.Eachnodeinthegraphcontainsavalue......
  • (3). Vscode 配置模板输出
    1.点击设置,选择配置用户代码片段2.选择vue.json3.配置快捷模板......
  • 200. Number of Islands[Medium]
    200.NumberofIslandsGivenanmxn2Dbinarygridgridwhichrepresentsamapof'1's(land)and'0's(water),returnthenumberofislands.Anislandissu......
  • vscode中使用powershell显示分支名
    https://blog.csdn.net/weixin_43932597/article/details/125000557windowspowershell(或windowsterminal)启动前会先执行一个.ps1的配置文件,通过修改此文件可以对powers......
  • vscode配置C++文件简记
    今天终于把vscode配置好了,这个玩意跟大爷一样难伺候。我也懒得写博客记录过程了,太麻烦了。而且我已经耽误太长时间在这里了,不想再经历一次了。我这里简单记录一下我遇到的......
  • c语言之各种printf(printf, sprintf, snprintf, swprintf, fprintf, fwprintf, vsprin
    一、v|s|f|n|w的含义v:参数作为va_list一个整体传入s:输出对象为内存缓冲区(char*,wchar_t*)f:输出对象为文件流(char*,wchar_t*)w:宽字符串版本n......
  • 麒麟客户端vsftp
    #麒麟客户端搭建vsftp,使用被动模式,麒麟客户端关闭防火墙#cp/etc/vsftpd.conf/etc/vsftpd.conf.bak#grep-Ev'^(#|$)'/etc/vsftpd.conf.bak>/etc/vsftpd.conf##li......