
codeforces
coldfresh
那我们开始吧
展开
-
Gerald and Giant Chess (CodeForces - 560E)(组合数)
Giant chess is quite common in Geraldion. We will not delve into the rules of the game, we’ll just say that the game takes place on an h × w field, and it is painted in two colors, but not like in ches原创 2017-06-05 21:26:31 · 534 阅读 · 0 评论 -
Mishka and Interesting sum CodeForces - 703D(离线处理)
Little Mishka enjoys programming. Since her birthday has just passed, her friends decided to present her with array of non-negative integers a1, a2, …, an of n elements!Mishka loved the array and she i原创 2017-07-02 14:21:21 · 421 阅读 · 0 评论 -
Infinite Inversions CodeForces - 540E (树状数组+离散化)
题目链接 题目大意,在一串无穷的1,2,3…n的串值,有k次操作,每次操作给出两个数a,b,即把坐标a和坐标b的值交换,问最后有多少个逆序对,0<=k<=105,a和b在int范围内0<=k<=10^5,a和b在int范围内 分析:问题的关键是,操作次数相对与整个序列是比较稀疏的,也就是说会有许多连续的数串 ,我们就是把这些连续的数串缩微一个点,而点的权值即为这个数串的数量,用离散化来处理,最后原创 2017-09-29 13:05:59 · 397 阅读 · 0 评论 -
Godsend CodeForces - 841B
Leha somehow found an array consisting of n integers. Looking at it, he came up with a task. Two players play the game on the array. Players move one by one. The first player can choose for his move a原创 2017-11-19 18:30:36 · 441 阅读 · 0 评论 -
Mahmoud and a Message CodeForces - 766C (dp)
Mahmoud wrote a message s of length n. He wants to send it as a birthday present to his friend Moaz who likes strings. He wrote it on a magical paper but he was surprised because some characters disapp原创 2017-11-20 22:15:50 · 354 阅读 · 0 评论 -
Hamiltonian Spanning Tree CodeForces - 618D (思维)
A group of n cities is connected by a network of roads. There is an undirected road between every pair of cities, so there are roads in total. It takes exactly y seconds to traverse any single road. ...原创 2018-03-29 23:03:04 · 250 阅读 · 0 评论 -
Finals in arithmetic CodeForces - 625D (构造)
Vitya is studying in the third grade. During the last math lesson all the pupils wrote on arithmetic quiz. Vitya is a clever boy, so he managed to finish all the tasks pretty fast and Oksana Fillipovn...原创 2018-03-30 10:30:24 · 279 阅读 · 0 评论 -
Minimum spanning tree for each edge CodeForces - 609E(ST算法+树链剖分(或倍增LCA)+最小生成树)
Connected undirected weighted graph without self-loops and multiple edges is given. Graph contains n vertices and m edges. For each edge (u, v) find the minimal possible weight of the spanning tree t...原创 2018-03-21 13:49:34 · 379 阅读 · 0 评论 -
【Codeforces Round #530】Sum in the tree(贪心构造)
做法: 我之前错误的做法是从前往后推的,优先最小,但是显然这是错误的,随便构造一个就能找到反例,当时没什么时间了,就没有怎么仔细想。因为实际上当越往根节点靠近时,这个点值应该越大越好,因为他可以以他为根子树的贡献越多,使得总体所有点权和越小,这个从直觉上就可以分析出来应该是没有问题,所以这个应该得从后往前推,如果这个点的s值没确定,那么应该取他的子节点的的s值当中的最小值。如果发现他的子节点都...原创 2019-01-07 11:56:45 · 382 阅读 · 0 评论