当前位置:网站首页>【学习笔记】阶段测试1
【学习笔记】阶段测试1
2022-07-05 14:10:00 【仰望星空的蚂蚁】
Menci 的序列
二进制 + 构造 + 贪心
第一眼是 dp 。想了 1.5h ,想不出来状态。
我会乱搞 !乱搞 80pts 。
首先把原序列改造一下。注意到 1000=010
这样构造后连续的 + 不超过 2 个
然后我们从高往低位贪心 。
显然是要用最少的 + 来构造。
因此最高位尽量不进位 。
不难想到贪心方案:从左往右遍历连续的 + 段,对于每一段连续的 + 只取一个,每一段连续的 * 也只取一个,这样前缀一定是 1111…
如果遇到后缀 * 不足的情况,那么这一段 * 的个数一定 >=2 ,足以隔断后面的选择对前面的影响(换句话说不可能进位了),那么我们只需让后面的 + 对答案贡献尽可能大 。
可以用两个二进制数相加来理解 。
你要问这个贪心怎么想到的,我也不知道 ,可能是感觉吧。
排序
膜拜 idsy …
这题第一感暴搜。
当然这题如果只能暴搜就太没意思了。
比如 Limak and Shooting Points 堪称搜索神题 。
其实正解挺显然啊 。
考虑 <=i 的操作都用了,那么对于长度为 2 i − 1 2^{i-1} 2i−1 的块内部顺序已定,毋宁看作一个整体 。
如果每一段都合法,则不执行操作;如果有一段不合法,则交换前后;如果有两段不合法,则分类讨论,最多有 2 2 2 种交换方法 。
这样可能的情况 2 n 2^n 2n 种,总复杂度 O ( 4 n ) O(4^n) O(4n) 。
注意别忘了乘阶乘 。
边栏推荐
- Laravel - view (new and output views)
- Recommendation number | what are interesting people looking at?
- R language ggplot2 visualization: use ggplot2 to visualize the scatter diagram, and use the labs parameter to customize the X axis label text (customize X axis labels)
- poi设置列的数据格式(有效)
- 无密码身份验证如何保障用户隐私安全?
- Discussion on memset assignment
- -Web direction attack and defense world
- 清大科越冲刺科创板:年营收2亿 拟募资7.5亿
- Current situation, trend and view of neural network Internet of things in the future
- Laravel - model (new model and use model)
猜你喜欢

明峰医疗冲刺科创板:年营收3.5亿元 拟募资6.24亿

物联网应用技术专业是属于什么类

Why do mechanical engineers I know complain about low wages?

How to deeply understand the design idea of "finite state machine"?

分享 12 个最常用的正则表达式,能解决你大部分问题

Tiflash compiler oriented automatic vectorization acceleration

TiFlash 源码解读(四) | TiFlash DDL 模块设计及实现分析

LeetCode_2(两数相加)

魅族新任董事長沈子瑜:創始人黃章先生將作為魅族科技產品戰略顧問

清大科越冲刺科创板:年营收2亿 拟募资7.5亿
随机推荐
金融壹账通香港上市:市值63亿港元 叶望春称守正笃实,久久为功
Sqllab 1-6 exercise
mysql 自定义函数 身份证号转年龄(支持15/18位身份证)
What are the advantages and characteristics of SAS interface
Financial one account Hong Kong listed: market value of 6.3 billion HK $Ye wangchun said to be Keeping true and true, long - term work
R语言使用MASS包的polr函数构建有序多分类logistic回归模型、使用coef函数获取模型中每个变量(自变量改变一个单位)对应的对数优势比(log odds ratio)
Shenziyu, the new chairman of Meizu: Mr. Huang Zhang, the founder, will serve as the strategic adviser of Meizu's scientific and technological products
upload (1-6)
为什么我认识的机械工程师都抱怨工资低?
分享 12 个最常用的正则表达式,能解决你大部分问题
故障分析 | MySQL 耗尽主机内存一例分析
LeetCode_ 69 (square root of x)
IP packet header analysis and static routing
TiCDC 6.0原理之Sorter演进
Don't be unconvinced. Mobile phone function upgrade is strong
Login interface code
Hongmeng fourth training
如何将 DevSecOps 引入企业?
基于伯努利原理的速度监测芯片可用于天然气管道泄露检测
Sorter evolution of ticdc 6.0 principle
