当前位置:网站首页>【7.8】Educational Codeforces Round 131 (Rated for Div. 2)
【7.8】Educational Codeforces Round 131 (Rated for Div. 2)
2022-07-19 13:40:00 【ZhgDgE】
ALL:6
AC:3
Supplementary questions :1
D. Permutation Restoration
The question : Here is a length of n ( n ≤ 2 × 1 0 5 ) n(n\leq 2\times 10^5) n(n≤2×105) Array a a a , b i = ⌊ i a i ⌋ b_i=\left\lfloor \frac{i}{a_i} \right\rfloor bi=⌊aii⌋ .
Now give b b b , Let you restore a a a . Make sure there's a solution .
Answer key :Educational Codeforces Round 131 D( greedy )
Ideas : First push the formula : From the title, we can see b i = ⌊ i a i ⌋ b_i=\left\lfloor \frac{i}{a_i} \right\rfloor bi=⌊aii⌋ , namely b i ≤ i a i < b i + 1 b_i\leq \frac{i}{a_i}<b_i+1 bi≤aii<bi+1 , namely i b i + 1 < a i ≤ i b i \frac{i}{b_i+1}<a_i\leq \frac{i}{b_i} bi+1i<ai≤bii , namely a i ∈ [ ⌊ i b i + 1 ⌋ + 1 , ⌊ i b i ⌋ ] a_i\in [\left\lfloor\frac{i}{b_i+1}\right\rfloor+1, \left\lfloor\frac{i}{b_i}\right\rfloor] ai∈[⌊bi+1i⌋+1,⌊bii⌋] .
The problem turns into a known L i , R i , i ∈ [ 1 , n ] L_i,R_i,i\in[1,n] Li,Ri,i∈[1,n] , Please arrange a i ∈ [ 1 , n ] a_i\in[1,n] ai∈[1,n] Satisfy L i ≤ a i ≤ R i L_i\leq a_i\leq R_i Li≤ai≤Ri , Similar to a task scheduling problem . Because the arrangement elements are different , We can enumerate 1 ∼ n 1\sim n 1∼n To allocate . Every time you enumerate to i i i Find out all L j ≤ i L_j\leq i Lj≤i The range of , And find the leftmost assignment of the right endpoint in these intervals .
AC Code :https://codeforces.com/contest/1701/submission/163997864
边栏推荐
- [postgraduate entrance examination vocabulary training camp] day 7 - second, attract, current, collect, simple, communicate, vocation
- Solutions to the failure of dedecms dream weaving to save the current column changes
- Galaxy Kirin V10 arm offline installation of portal
- Onvif protocol related: 2.1.2 get screenshot URL in none mode
- [code hoof set novice village 600 questions] the implementation of scientific counting method, output index form
- onvif协议相关:4.1.3 WS-Username token方式获取截图url
- 弘业期货网上开户安全吗?有没有开户指引?
- mysql排序索引失效?
- 这些年我开源的几个小项目
- 「技术播客月」Day 10: Meta Podcast: 聊聊播客这件事
猜你喜欢
【码蹄集新手村 600 题】运算符 / 在不同的运算顺序中的类型转换
2.三数之和
565. Array nesting
[postgraduate entrance examination vocabulary training camp] day 6 - eventually, state, create, productivity, stimulate
Onvif protocol related: 3.1.2 get the token list in digest mode
响应式织梦模板物流货运服务类网站
Code after annotation of hands-on deep learning (Second Edition) [continuous update]
Attachment handling of SAP Fiori
sqli-labs(less-11)
【考研词汇训练营】Day 6 —— eventually,state,create,productivity,stimulate
随机推荐
Codeforces Round #808 (Div. 2)ABCD
如何优雅的升级 Flink Job?
[JS reverse crawler] - Youdao translation JS reverse practice
torch. utils. data. Dataloader description
[postgraduate entrance examination vocabulary training camp] day 6 - eventually, state, create, productivity, stimulate
Codeforce:g. good key, bad key [greed]
基于PMOS的过压保护(OVP)电路仿真
Flutter 使用 AnimatedSwitcher 做场景切换
SSH keyless login
响应式织梦模板物流货运服务类网站
【动态规划】—— 最长上升子序列模型
2.三数之和
Forget about postman. Apifox is better
【考研词汇训练营】Day 7 —— second,attract,current,collect,simple,communicate,vocation
ONVIF Protocol Related: 4.1.3 WS - username token Method get capture d'écran URL
【7.8】Educational Codeforces Round 131 (Rated for Div. 2)
忘掉Postman,Apifox更好用
如何优雅的升级 Flink Job?
How to upgrade Flink job gracefully?
Security measures for tcp/ip protocol vulnerabilities