![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
codeforces
yqdjl6
这个作者很懒,什么都没留下…
展开
-
Round#419 C Karen and Game
**Karen and Game** On the way to school, Karen became fixated on the puzzle game on her phone! The game is played as follows. In each level, you have a grid with n rows and m columns. Each cell ori原创 2017-06-21 00:43:02 · 404 阅读 · 0 评论 -
codefoeces 513E Sergey and Subway
这题大意是给你一棵树,然后如果u和v共用一个点w,那么u和v之间也连一条边,问所有对点之间的距离和是多少。这题画画图以后可以得出:树上偶数距离的点在加边以后的距离等于距离/2,树上奇数距离的点在加边以后的距离等于距离/2+1。所以加边以后的答案等于(原树上的距离+两点之间距离为奇数的对数)/2。原树上的距离直接dfs就行,这个两点之间距离为奇数的对数没想到,答案应该是距离root为偶数的点乘距...原创 2018-10-05 22:24:45 · 170 阅读 · 0 评论 -
Codeforces Round #495 (Div. 2)E. Sonya and Ice Cream
在树上找k个点,使树上每个点距能够找到的点距离最短。首先这k个点肯定是在直径上,其次怎么在直径上找k个点,我们可以用滑动窗口,学滑动窗口就要回单调队列,这玩意自己以前一直不会,最近才写题的时候遇到的。哎。首先用单调队列判断队尾元素是否该继续留在里面,如果不留在里面,就弹出来,然后把当前元素塞进去,然后判断队首元素是否超出滑动窗口的长度限制,如果超出,就弹出队首元素。代码中的dfs是用来找当前这个点...原创 2018-07-13 01:46:33 · 181 阅读 · 0 评论 -
Educational Codeforces Round 2E. Lomsat gelral
题目是说给你一棵树,树上每个点有一个权,问你对于每个点,其子树出现次数最多的数是多少,如果有相同的,求这几个点的和。 启发式合并的裸题。意思我将树分成多条重链和轻链,每次都把轻链往重链上合并,这样将一棵树分成了最多logn条重链,所以每个点最多合并logn次。 dfs的时候,首先dfs节点x的轻儿子,暴力消去影响,再dfs节点x的下一个轻儿子,依次类推。 然后dfs节点x的重儿子,无需消去影响...原创 2018-07-16 21:58:55 · 170 阅读 · 0 评论 -
Codeforces Beta Round #10
A - Power Consumption Calculation题意:有一台电脑,电脑有三种状态,工作时的功率是P1w,当T1分钟不工作后,功率变为P2w,当T2分钟不工作后,功率变为P3w,给定工作的时间段[l1,r1],[l2,r2]…[ln,rn],问[l1,rn]消耗的电能是多少 模拟一下就行…主要是读对题By yqdjl6, contest: Codeforces Bet...原创 2018-06-27 01:09:19 · 259 阅读 · 0 评论 -
Codeforces Round #470 (rated, Div. 2, based on VK Cup 2018 Round 1) C
题目的意思是说每天会新生成一个体积为Vi的雪堆,每天每个雪堆会融化Ti的体积,问每天融化的体积,我想了半天,我知道是前缀和,就是不知道怎么用前缀和,真是被自己的气到了,要好好学一学前缀和了,上一次也是cf卡在前缀和上。首先我们先输入每一天的Vi,然后怎么算融化的体积呢,我们可以想成温度是累加的,那么我每天新生成的雪堆就变成了Vi+(T1+T2+T3+…T(i-1)),然后将我的今天的温度加上去,也就原创 2018-03-11 03:12:50 · 193 阅读 · 0 评论 -
Codeforces Educational Codeforces Round 37 E
You are given an undirected graph consisting of n vertices and edges. Instead of giving you the edges that exist in the graph, we give you m unordered pairs (x, y) such that there is no edge between x原创 2018-02-03 18:16:27 · 263 阅读 · 0 评论 -
Educational Codeforces Round 34 E Swapping Characters
E Swapping CharactersWe had a string s consisting of n lowercase Latin letters. We made k copies of this string, thus obtaining k identical strings s1, s2, …, sk. After that, in each of these strings w原创 2017-12-15 01:36:11 · 455 阅读 · 0 评论 -
Codeforces Round #440
You are given several queries. In the i-th query you are given a single positive integer ni. You are to represent ni as a sum of maximum possible number of composite summands and print this maximum num原创 2017-11-02 00:12:58 · 345 阅读 · 0 评论 -
Codeforces Round #432 C. Five Dimensional Points
C. Five Dimensional PointsYou are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide.We will call point a bad if there are different points b and c原创 2017-09-08 20:11:59 · 278 阅读 · 0 评论 -
849B Tell Your World
849B Tell Your WorldConnect the countless points with lines, till we reach the faraway yonder.There are n points on a coordinate plane, the i-th of which being (i, yi).Determine whether it’s possible t原创 2017-09-03 22:09:37 · 224 阅读 · 0 评论 -
Round #425 (Div. 2)B. Petya and Exam
B. Petya and ExamIt’s hard times now. Today Petya needs to score 100 points on Informatics exam. The tasks seem easy to Petya, but he thinks he lacks time to finish them all, so he asks you to help wit原创 2017-07-26 20:00:23 · 259 阅读 · 0 评论 -
Round 422 C. Hacker, pack your bags!
It’s well known that the best way to distract from something is to do one’s favourite thing. Job is such a thing for Leha.So the hacker began to work hard in order to get rid of boredom. It means that原创 2017-07-04 00:57:56 · 342 阅读 · 0 评论 -
Lyft Level 5 Challenge 2018 - Elimination Round D
题目大意是给你n个数,然后让你把n个数相乘,求乘积约数的个数,a[i]<=2e18。题目保证每个a[i]的约数在3到5个之间。这个条件很有用,因为一个数的约数最少为2个,1和它本身,所以可能情况只有4种pq,p的平方,p的三次方,p的四次方。后三个直接套就可以,第一个我们需要特殊处理一下,因为这种情况肯定是两个质数相乘,我们需要先判断p或q是否在其他a[j]中出现过,如果出现过,我们直接把p...原创 2018-10-08 14:56:13 · 241 阅读 · 0 评论