Educational Codeforces Round 66 (Rated for Div. 2)

a题教育我:不手写2个测试用例,就不要写代码,谢谢。

b题真的恶心,判断溢出自己之前从没思考过的问题。最后用了很尴尬的判断,a=b+c的时候,三个数不能>=(1<<32),不能小于0,不知道为什么,也不想知道。

c题是思维gap的味道,也靠推导能力,看你有没有思维jump的能力。用到了我特别喜欢的一种思考模式:设想答案长什么样子。答案肯定是中点离着两边一样远,才能最小化d(k),然后这个区间必然是覆盖了k个点,所以排序后固定长度的滑窗走起~

d题。原来每次打比赛之前,我都在本子上手写两条:1.dp,2.二分。现在我有了第三条(虽然没有那么的普适性):前缀和。出题者必须有意转换思考的维度,这个题就是取最大的k个前缀和,是的实现就是这么简单。但是这个gap也不小,你不能推导,这个是需要跳跃性思维的。

e题Minimal Segment Cover。e题是让我写下这个随笔的原因。让我学到了一个新的操作。在一个向后跳转的array里面,每个位置上的值都是它能向后跳几步。那么对于单次查询,那么就是简单的贪心算法,O(n)时间复杂度。但是有m=10^5次查询的话,怎么避免O(n*m)次查询?想了好久没想出来,竟然用的是类似线段树的思想。构建20个数组a[20][n],a[i]代表跳转(1<<i)次的最大终点。那么一层层踩楼梯就能上咯。厉害了word哥。

原文地址:https://www.cnblogs.com/waldenlake/p/10984392.html

时间: 2024-08-01 16:26:11

Educational Codeforces Round 66 (Rated for Div. 2)的相关文章

Educational Codeforces Round 66 (Rated for Div. 2) A

A. From Hero to Zero 题目链接:http://codeforces.com/contest/1175/problem/A 题目 ou are given an integer n and an integer kIn one step you can do one of the following moves:decrease n by 1;divide n by k if n is divisible by k.For example, if n=27 and k=3 yo

Educational Codeforces Round 36 (Rated for Div. 2)

Educational Codeforces Round 36 (Rated for Div. 2) F. Imbalance Value of a Tree You are given a tree T consisting of n vertices. A number is written on each vertex; the number written on vertex i is ai. Let's denote the function I(x,?y) as the differ

Educational Codeforces Round 69 (Rated for Div. 2) B - Pillars

Educational Codeforces Round 69 (Rated for Div. 2) B - Pillars There are n pillars aligned in a row and numbered from 1 to n. Initially each pillar contains exactly one disk. The i-th pillar contains a disk having radius ai. You can move these disks

Educational Codeforces Round 71 (Rated for Div. 2) D - Number Of Permutations

原文链接:https://www.cnblogs.com/xwl3109377858/p/11405773.html Educational Codeforces Round 71 (Rated for Div. 2) D - Number Of Permutations You are given a sequence of n pairs of integers: (a1,b1),(a2,b2),…,(an,bn). This sequence is called bad if it is

Educational Codeforces Round 36 (Rated for Div. 2) 题解

Educational Codeforces Round 36 (Rated for Div. 2) 题目的质量很不错(不看题解做不出来,笑 Codeforces 920C 题意 给定一个\(1\)到\(n\)组成的数组,只可以交换某些相邻的位置,问是否可以将数组调整为升序的 解题思路 首先如果每个数都能通过交换到它应该到的位置,那么就可以调整为升序的. 但实际上交换是对称的,如果应该在的位置在当前位置前方的数都交换完成,那么整体就是排好序的,因为不可能所有不在相应位置的数都在相应位置的后方.

Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes

Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://codeforces.com/contest/985/problem/E Description Mishka received a gift of multicolored pencils for his birthday! Unfortunately he lives in a monochrome w

Educational Codeforces Round 55 (Rated for Div. 2)

Educational Codeforces Round 55 (Rated for Div. 2) 链接 A Vasya and Book 傻逼题..注意判边界. #include<cstdio> #include<cstring> #include<algorithm> #include<queue> #include<set> #include<map> #include<vector> #include<cm

Educational Codeforces Round 57 (Rated for Div. 2)

get人生第二场CF! 成绩:(exACM) rank858 AC3/7 Penalty57 rating1648(+52) 题目:Educational Codeforces Round 57 (Rated for Div. 2) 错题题解: D. Easy Problem E. The Top Scorer F. Inversion Expectation G. Lucky Tickets 原文地址:https://www.cnblogs.com/xht37/p/10198321.html

Educational Codeforces Round 58 (Rated for Div. 2)(待更新)

get人生第七场CF! 成绩:(exACM) rank AC3/7 Penalty104 rating() 题目:Educational Codeforces Round 58 (Rated for Div. 2) 错题题解: C. Division and Union 原文地址:https://www.cnblogs.com/xht37/p/10260260.html