当前位置:网站首页>[learning notes] stage test 1
[learning notes] stage test 1
2022-07-05 14:18:00 【Ants looking up at the starry sky】
Menci Sequence
Binary system + structure + greedy
At first glance dp . Think about 1.5h , Can't think of the state .
I'll mess around ! fool around with 80pts .
First, transform the original sequence . be aware 1000=010
After such construction, it is continuous + No more than 2 individual
Then we are greedy from high to low .
Obviously, we should use the least + To construct the .
So try not to carry the highest bit .
It is not difficult to think of a greedy plan : Traverse continuous... From left to right + paragraph , For each successive + Take only one , Each segment is continuous * Only take one , The prefix must be 1111…
If you encounter a suffix * Insufficient situation , So this paragraph * There must be a number of >=2 , Enough to isolate the influence of the later choice on the front ( In other words, it is impossible to carry ), Then we just need to let the latter + Contribute as much as possible to the answer .
It can be understood by adding two binary numbers .
You have to ask how this greed came to mind , I don't know either , Maybe it's a feeling .
Sort
Worship idsy …
The first feeling of this question is a fierce search .
Of course, this question is too boring if it can only be searched violently .
such as Limak and Shooting Points It can be called a search topic .
In fact, the positive solution is quite obvious .
consider <=i All operations are used , So for a length of 2 i − 1 2^{i-1} 2i−1 The internal order of the block has been determined , Rather as a whole .
If every paragraph is legal , The operation is not performed ; If a paragraph is illegal , Before and after the exchange ; If two paragraphs are illegal , Then classified discussion , At most 2 2 2 An exchange method .
Such a possible situation 2 n 2^n 2n Kind of , The sum O ( 4 n ) O(4^n) O(4n) .
Be careful not to forget factorial .
边栏推荐
- 做自媒体视频二次剪辑,怎样剪辑不算侵权
- 一网打尽异步神器CompletableFuture
- TiFlash 面向编译器的自动向量化加速
- Geom of R language using ggplot2 package_ Histogram function visual histogram (histogram plot)
- VC development of non MFC program memory leak tracking code
- Google eventbus usage details
- POI set the data format of the column (valid)
- LeetCode_ 3 (longest substring without repeated characters)
- 【学习笔记】图的连通性与回路
- 故障分析 | MySQL 耗尽主机内存一例分析
猜你喜欢

无密码身份验证如何保障用户隐私安全?

tidb-dm报警DM_sync_process_exists_with_error排查

日化用品行业智能供应链协同系统解决方案:数智化SCM供应链,为企业转型“加速度”

Detailed explanation of IP address and preparation of DOS basic commands and batch processing

LeetCode_ 2 (add two numbers)

Opengauss database source code analysis series articles -- detailed explanation of dense equivalent query technology (Part 2)

Oneconnect listed in Hong Kong: with a market value of HK $6.3 billion, ye Wangchun said that he was honest and trustworthy, and long-term success

治臻新能源冲刺科创板:年营收2.2亿 上汽创投是股东

Why do mechanical engineers I know complain about low wages?

TiFlash 源码解读(四) | TiFlash DDL 模块设计及实现分析
随机推荐
R language ggplot2 visual density map: Visual density map by group and custom configuration geom_ The alpha parameter in the density function sets the image transparency (to prevent multiple density c
分享 12 个最常用的正则表达式,能解决你大部分问题
Fault analysis | analysis of an example of MySQL running out of host memory
做自媒体视频二次剪辑,怎样剪辑不算侵权
LeetCode_ 3 (longest substring without repeated characters)
Principle and performance analysis of lepton lossless compression
魅族新任董事长沈子瑜:创始人黄章先生将作为魅族科技产品战略顾问
Shenziyu, the new chairman of Meizu: Mr. Huang Zhang, the founder, will serve as the strategic adviser of Meizu's scientific and technological products
R language dplyr package select function, group_ By function, mutate function and cumsum function calculate the cumulative value of the specified numerical variable in the dataframe grouping data and
Sqllab 1-6 exercise
R语言dplyr包select函数、group_by函数、mutate函数、cumsum函数计算dataframe分组数据中指定数值变量的累加值、并生成累加数据列
Sharing the 12 most commonly used regular expressions can solve most of your problems
R语言使用原生包(基础导入包、graphics)中的boxplot函数可视化箱图(box plot)
ASP.NET大型外卖订餐系统源码 (PC版+手机版+商户版)
What category does the Internet of things application technology major belong to
Judge whether the variable is an array
一网打尽异步神器CompletableFuture
根据CronSequenceGenerator计算cron表达式的时间
Google EventBus 使用详解
故障分析 | MySQL 耗尽主机内存一例分析
