首页 > 其他分享 >Codeforces Round #180 (Div. 2) 解题报告

Codeforces Round #180 (Div. 2) 解题报告

时间:2022-11-16 12:04:43浏览次数:75  
标签:parity number give into Codeforces bi 180 part Div


​题目链接​

A.​​Snow Footprints​

​A - Snow Footprints​

The starting position can be anywhere with a footprint. The footprints can be categorized into 3 types.

  1. L
  2. R
  3. R s followed by L

R or the leftmost L

​B - Sail​

We can simply move by greedy method — only moves when it takes the boat closer to the destination.

​C - Parity Game​

Fact 0: If a has odd parity, we can apply operation 1 to increase its number of 1 by 1.

Fact 1: If a has a even parity, its number of 1

a has parity 0, unless we pop a 1, otherwise we cannot write a new 1 into a.

Fact 2: If the number of 1 in a is not less than the one in b, we can always turn a to b

b at the right of a. Lets assume a has even parity now. If we need a 0, simply apply operation 1. If we need a 1, keep remove from head until we remove a 1. Notice that we never remove digits from 'new part' of a. Now the parity of a will be odd and we can apply operation 1. After that, the parity of a becomes even again, the number of 1 in the 'old part' of a decrease by 1 and we handle a 1 in b.

a. Now we get b.

a into b


countOnes(a) + parity(countOnes(a)) ≥ countOnes(b)

​D - Fish Weight​

n > m, set every weight to 1 and done. Otherwise, lets sort a and b in non-increasing order, and trim the last part of b such that its length equals a.

Claim: answer is YES if and only if exists i such that ai > bi

 If for every iai ≤ bi, that means for every Alice's fish, there is a correspond Bob's fish which is as heavy as Alice's.

 Let i be the smallest one such that ai > bi. We can amplify the gap between wai and wbi

​E - Splitting the Uniqueness​

An equivalent definition for almost unique, is arrays with at least ⌊ 2n / 3⌋ different elements. The idea is to split s into three parts. In the first part, we give uniqueness to a. In the second part, we give uniqueness to b. In the third part, we give uniqueness to both.

s is sorted. Since s is an unique array, si ≥ i for all i (0-based). The image below will give some intuition on how to split it. ais red, b


n = 30.

i = 0... 9:  assign ai = i (do not care values of b)

i = 10... 19:  assign bi = i (do not care values of a)

i = 20... 29:  assign bi = 29 - ia takes the remains. From i = 20, a will have strictly increasing values starting from at least 11.

标签:parity,number,give,into,Codeforces,bi,180,part,Div
From: https://blog.51cto.com/xindoo/5855717

相关文章

  • 2022 年杭电多校第六场 Multiply 2 Divide 2
    2022年杭电多校第六场Multiply2Divide2题意:BXY的序列\(a\)长度为\(n\)\((1\leqn\leq10^5,1\leqa_i\leq10^5)\)对于每个操作,他选择一个数字\(a_i(1\leqi\leqn......
  • codeforces补题计划
    11.15CodeforcesRound#833(Div.2)知识点:D:高位和对低位无影响E:笛卡尔树上dp补题传送门......
  • Codeforces Round #833 (Div. 2)补题
    CodeforcesRound#833(Div.2)D.ConstructOR知识点:高位和对低位无影响一开始以为和广州的M一样,是数位dp,后来发现只要找到一个就行果然无论什么时候都要看清题目......
  • Codeforces Round #833 (Div. 2)
    CodeforcesRound#833(Div.2)做题记录A.TheUltimateSquare略过B.DiverseSubstrings思路:我们发现字符数只有0~9十种字符,也就是说,如果我们固定一个左端点\(l\),......
  • Codeforces #816 1715 C
    题面假设我们有一个函数$g(1,n)$表示$i=1\simn-1$中满足$a_i\neqa_{i+1}$的$i$的数量。现在有$m$个询问,每个询问将会让$x\rightarrow......
  • [VP]Codeforces Round #390 (Div. 2)
    和\(\color{black}{a}\color{red}{rtalter}\)一起打的顺嘴说一下今天(周日)早晨的趣逝事情发生在吃完早饭后,\(\color{grey}{WintersRain}\)和\(\color{black}{S}\color......
  • Codeforces 1748 D
    这场D还是很有趣的,值得探讨。首先\(a|x,b|x\)是两个数,不相同时不太好做,所以我们能否找到一个\(x\),满足\(a|x=b|x\)并且都是\(d\)的倍数呢?然后我们让\(d\)特殊一些——我......
  • B. Diverse Substrings
    B.DiverseSubstringsAnon-emptydigitstringisdiverseifthenumberofoccurrencesofeachcharacterinitdoesn'texceedthenumberofdistinctcharacters......
  • Codeforces Round #833 (Div. 2)(持续更新)
    Preface我是大FW,B因为本地调试的时候把数组大小改成200忘记该回去了浪费了很多时间和罚时C刚开始也没想清楚WA了两发心态爆炸,然后D其实想出了一种做法但是心态崩了就没写......
  • Educational Codeforces Round 35 (Rated for Div. 2) F. Tree Destruction(树的直径/
    题目大意是给定一棵树,每次选择两个叶子将其删除,同时将两个叶子之间的简单路径长度加到答案上,找到一种方案使答案最大化,并输出删除的顺序。首先有一个结论是,距离树上某个节......