
Codeforce~
文章平均质量分 83
xuanweiace
一个热爱算法竞赛的弱校ACMer路过。青大本,浙大硕,方向后端开发,菜鸡一枚,奋斗ing...
展开
-
【CodeForces - 208C 】Police Station(单源最短路条数,起点终点建图,枚举顶点)
题干:The Berland road network consists ofncities and ofmbidirectional roads. The cities are numbered from 1 ton, where the main capital city has numbern, and the culture capital — number1. The ...原创 2019-11-07 16:02:13 · 585 阅读 · 0 评论 -
【Gym - 101612C】【2017-2018NEERC】Consonant Fencity(状压枚举,预处理)
题干:把26个字母分成19个辅音字母和7个元音字母,让你通过 将某些字母改为大写状态,使得字符串中连续的两个大小写状态不同的辅音字母组成的字母对数量最多,输出该状态下的字符串。注意输出的字符串中同一字母必须形态统一,也就是对于同一个字母,不能既有大写状态的,也有小写状态的。如果有多种可能的解,输出任意一种。解题报告:注意到除去元音字母,还剩下19个辅音字母,这样我们第一步可以2^19...原创 2019-11-02 17:08:25 · 255 阅读 · 0 评论 -
【CodeForces - 722D】Generating Sets(二分,贪心)
题干:You are given a setYofndistinctpositive integersy1, y2, ..., yn.SetXofndistinctpositive integersx1, x2, ..., xnis said togeneratesetYif one can transformXtoYby applying som...原创 2019-10-31 20:51:32 · 290 阅读 · 0 评论 -
【Codeforces - 769D】k-Interesting Pairs Of Integers(暴力,统计,思维,数学,异或)
题干:Vasya has the sequence consisting ofnintegers. Vasya consider the pair of integersxandyk-interesting, if their binary representation differs from each other exactly inkbits. For example, ...原创 2019-10-31 20:42:40 · 571 阅读 · 0 评论 -
【CodeForces - 789D】Weird journey(思维,图的性质,tricks,有坑)
题干:Little boy Igor wants to become a traveller. At first, he decided to visit all the cities of his motherland— Uzhlyandia.It is widely known that Uzhlyandia hasncities connected withmbidirec...原创 2019-10-25 13:47:53 · 318 阅读 · 0 评论 -
【CodeForces - 789C】Functions again(最大子段和变形,dp,思维)
题干:Something happened in Uzhlyandia again... There are riots on the streets... Famous Uzhlyandian superheroes Shean the Sheep and Stas the Giraffe were called in order to save the situation. Upon th...原创 2019-10-25 13:41:09 · 304 阅读 · 1 评论 -
【CodeForces - 746E】Numbers Exchange(贪心构造)
题干:Eugeny hasncards, each of them has exactly one integer written on it. Eugeny wants to exchange some cards with Nikolay so that the number of even integers on his cards would equal the number of...原创 2019-10-25 13:34:51 · 394 阅读 · 0 评论 -
【CodeForces - 827A】String Reconstruction(并查集合并区间,思维)
题干:Ivan had stringsconsisting of small English letters. However, his friend Julia decided to make fun of him and hid the strings. Ivan preferred making a new string to finding the old one.Ivan ...原创 2019-10-25 13:28:56 · 842 阅读 · 0 评论 -
【CodeForces - 706D】Vasiliy's Multiset(01字典树)
题干:Author has gone out of the stories about Vasiliy, so here is just a formal task description.You are givenqqueries and a multisetA, initially containing only integer0. There are three types ...原创 2019-10-25 13:16:51 · 206 阅读 · 0 评论 -
【CodeForces - 705C】Thor(模拟,STLset优化链表)
题干:Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There arenapplications on this phone. Thor is fascinated by this phone. He has only one minor issue: he can't count the ...原创 2019-10-25 13:06:58 · 286 阅读 · 0 评论 -
【CodeForces - 701D】As Fast As Possible(二分,模拟,数学公式)
题干:On vacationsnpupils decided to go on excursion and gather all together. They need to overcome the path with the lengthlmeters. Each of the pupils will go with the speed equal tov1. To get to...原创 2019-10-25 12:53:56 · 357 阅读 · 0 评论 -
【Codeforces - 822C】Hacker, pack your bags!(思维)
C. Hacker, pack your bags!time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIt's well known that the best way to distract from...原创 2019-10-31 21:04:12 · 205 阅读 · 0 评论 -
【CodeForces - 697D】Puzzles(树形dp,期望dp)
题目大意:给定一棵树,从1开始,按DFS的方式访问这棵树每次从父亲节点随机访问儿子,问每个节点被访问到的时间的期望输入:第一行一个数n,代表n个节点。第二行n-1个数p2,p3,p4,p5...,pn-1,其中pi代表i号节点的父节点编号,1号节点一定是根节点。ExamplesInput71 2 1 1 4 4Output1.0 4.0 5.0 3.5 4....原创 2019-10-14 19:17:04 · 313 阅读 · 0 评论 -
【CodeForces - 514D】R2D2 and Droid Army(二分+滑动窗口ST表,或 尺取+单调队列或STLmultiset)
题干:An army ofndroids is lined up in one row. Each droid is described bymintegersa1, a2, ..., am, whereaiis the number of details of thei-th type in this droid's mechanism. R2-D2 wants to des...原创 2019-10-14 19:16:44 · 337 阅读 · 0 评论 -
【CodeForces - 460C】Present(二分+树状数组)
题干:给定N朵花的原先的高度,从左到右排列,最多浇水m天,每天只能浇一次,每次使得连续的w朵花的高度增长1,问最后最矮的花的高度最高是多少。ExamplesInput6 2 32 2 2 2 1 1Output2Input2 5 15 8Output9NoteIn the first sample beaver can water...原创 2019-10-14 19:16:52 · 294 阅读 · 0 评论 -
【CodeForces - 514C】Watto and Mechanism(字符串哈希)
题干:输入n个字符串,然后进行m次询问,每次询问输入一个字符串,问n个字符串中是否存在与当前输入的字符串长度相等,并且刚好有且仅有一个位置的字符不同。存在则输出YES,不存在输出NO。ExamplesInput2 3aaaaaacacacaaabaaccacacccaaacOutputYESNONO解题报告: 刚开始读错题了,还以为需要对于每...原创 2019-10-14 19:16:36 · 462 阅读 · 1 评论 -
【CodeForces - 628C】Bear and String Distance(贪心,构造)
Description定义两个小写字母之间的距离为这两个字母在字母表中的距离,如dis(a,z)=25,dis(a,c)=2,两个长度相同串的距离为这两个串对应位置字母距离之和。现给出一个长度为n的串s和一个距离k,问是否存在一个长度为n的串ss,使得dis(s,ss)=k,如果存在任意输出一解,如果不存在则输出-1Input第一行为两个整数n,k(1<=n<=10^5,1...原创 2019-10-11 22:02:40 · 249 阅读 · 0 评论 -
【CodeForces - 697C】Lorenzo Von Matterhorn(二叉树,思维)
题干:巴尼住在NYC。NYC具有从1开始的正整数编号的无数个交叉点。在交叉点i和2i之间以及i和2i + 1之间存在双向道路,对任意整数i都满足。在任意两点之间都有且只有一条最短路。最初任何人都可以通过任何道路免费。 但是后来发生了 q 个事件。 有两种类型的事件:1. 政府制定新规。 一个规则可以用三个整数表示v,u和w。经过这次操作,点u到点v...原创 2019-10-11 21:49:21 · 425 阅读 · 0 评论 -
【CodeForces - 599C 】Day at the Beach(思维)
题干:给定一个数列A,要求你将这个数列划分成几个连续的部分,使得每部分分别从小到大排序后整个数列有序。问最多可以划分成几个部分。Input第一行包含一个整数n(1 ≤ n ≤ 100 000)— 表示数列的长度之后一行n个整数hi(1 ≤ hi ≤ 109). 描述这个数列。Output输出最多能划分出的部分数。ExampleInput31...原创 2019-10-11 21:19:20 · 243 阅读 · 0 评论 -
【CodeForces - 124C】Prime Permutation(数学,思维,小结论)
题干:You are given a strings, consisting of small Latin letters. Let's denote the length of the string as|s|. The characters in the string are numbered starting from1.Your task is to find out if ...原创 2019-10-11 20:27:38 · 295 阅读 · 0 评论 -
【Codeforces - 1000C】Covered Points Count(思维,离散化,差分)
题干:You are givennnsegments on a coordinate line; each endpoint of every segment has integer coordinates. Some segments can degenerate to points. Segments can intersect with each other, be nested i...原创 2019-10-11 20:26:34 · 301 阅读 · 0 评论 -
【CodeForces - 999D】Equalize the Remainders(思维,贪心)
题干:You are given an array consisting ofnnintegersa1,a2,…,ana1,a2,…,an, and a positive integermm. It is guaranteed thatmmis a divisor ofnn.In a single move, you can choose any positioniibe...原创 2019-10-11 20:25:36 · 286 阅读 · 0 评论 -
【CF566#D】 Restructuring Company (并查集---合并区间操作)
题干:Even the most successful company can go through a crisis period when you have to make a hard decision — to restructure, discard and merge departments, fire employees and do other unpleasant stuff...原创 2018-07-20 08:57:19 · 672 阅读 · 0 评论 -
【CF#192 A】Funky Numbers (二分,查找,二元组)
题干:As you very well know, this year's funkiest numbers are so called triangular numbers (that is, integers that are representable as , where k is some positive integer), and the coolest numbers are ...原创 2018-09-13 11:45:30 · 291 阅读 · 0 评论 -
【CF#801 A.】 Vicious Keyboard(字符串查找,水题)
题干:Tonio has a keyboard with only two letters, "V" and "K".One day, he has typed out a string s with only these two letters. He really likes it when the string "VK" appears, so he wishes to change at ...原创 2018-07-12 23:33:48 · 407 阅读 · 0 评论 -
cf#401(Div. 2)B. Game of Credit Card(田忌赛马类贪心)
题干:After the fourth season Sherlock and Moriary have realized the whole foolishness of the battle between them and decided to continue their competitions in peaceful game of Credit Cards.Rules of this...原创 2018-07-12 12:19:01 · 380 阅读 · 0 评论 -
【CF#757A】Gotta Catch Em' All!
题干:Bash wants to become a Pokemon master one day. Although he liked a lot of Pokemon, he has always been fascinated by Bulbasaur the most. Soon, things started getting serious and his fascination turn...原创 2018-07-12 23:53:41 · 292 阅读 · 0 评论 -
【CF#468 div2 D. 】Peculiar apple-tree(思维)
题干:In Arcady's garden there grows a peculiar apple-tree that fruits one time per year. Its peculiarity can be explained in following way: there areninflorescences, numbered from1ton. Infloresce...原创 2018-07-24 16:27:59 · 303 阅读 · 0 评论 -
【CF#931.B】World Cup (思维,模拟)
题干:The last stage of Football World Cup is played using the play-off system.There are n teams left in this stage, they are enumerated from 1 to n. Several rounds are held, in each round the remain...原创 2018-07-24 16:42:37 · 691 阅读 · 0 评论 -
【CF#148B】Escape(模拟)
题干:The princess is going to escape the dragon's cave, and she needs to plan it carefully.The princess runs at vp miles per hour, and the dragon flies at vd miles per hour. The dragon will discover...原创 2018-07-26 00:53:11 · 355 阅读 · 0 评论 -
【CF#706B】 Interesting drink (二分)
题干: 瓦西里喜欢在努力工作后休息,所以你可能经常在附近的一些酒吧见到他。他喜欢 "Beecola",可以从 n 个不同的商店买到。在第 i 个商店的价格为 xi 元。瓦西里计划购买他最喜欢的饮料 q 次。在第 i 天他能花 mi 元。他想知道每天他能在多少个商店中买这些饮料。Input第一行包含一个整数 n (1 ≤ n ≤ 100 000) — 表示商店的数量。第二行包...原创 2018-07-27 16:41:36 · 387 阅读 · 0 评论 -
【CF#459 A 】Pashmak and Garden (水题)
题干:Pashmak has fallen in love with an attractive girl called Parmida since one year ago...Today, Pashmak set up a meeting with his partner in a romantic garden. Unfortunately, Pashmak has forgotten wh...原创 2018-07-15 23:41:18 · 254 阅读 · 0 评论 -
【CF#2A】Winner(模拟 STL-map)☆
题干:The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, h...原创 2018-07-29 21:46:44 · 359 阅读 · 0 评论 -
*【CF#510C】Fox And Names (拓扑排序)
题干:Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in the lexicographical order....原创 2018-08-05 13:53:41 · 285 阅读 · 0 评论 -
【Codeforces - 378C】Maze(dfs,思维)
题干:Pavel loves grid mazes. A grid maze is ann × mrectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common si...原创 2018-08-30 22:36:03 · 653 阅读 · 0 评论 -
【Codeforces - 632C】The Smallest String Concatenation (对string巧妙排序)
题干:You're given a list ofnstringsa1, a2, ..., an. You'd like to concatenate them together in some order such that the resulting string would be lexicographically smallest.Given the list of stri...原创 2018-08-20 21:19:08 · 373 阅读 · 0 评论 -
【CodeForces - 833A】The Meaningless Game(思维题,数学,可用牛顿迭代法,知识点总结)
题干:Slastyona and her loyal dog Pushok are playing a meaningless game that is indeed very interesting.The game consists of multiple rounds. Its rules are very simple: in each round, a natural num...原创 2018-09-04 16:05:11 · 561 阅读 · 0 评论 -
【CodeForces - 670D1 】Magic Powder - 1 (模拟 或 枚举 或二分优化)
题干:This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you f...原创 2018-09-05 00:49:15 · 343 阅读 · 0 评论 -
【CodeForces - 735B】Urbanization (找规律,思维)
题干:Local authorities have heard a lot about combinatorial abilities of Ostap Bender so they decided to ask his help in the question of urbanization. There are n people who plan to move to the cities...原创 2018-09-08 19:37:19 · 383 阅读 · 0 评论 -
*【CodeForces - 799C】Fountains (线段树 或 树状数组,类似二元组问题)
题干:Arkady plays Gardenscapes a lot. Arkady wants to build two new fountains. There arenavailable fountains, for each fountain its beauty and cost are known. There are two types of money in the gam...原创 2018-09-09 01:14:45 · 591 阅读 · 2 评论