CF
文章平均质量分 76
nka_kun
ACMer
展开
-
CodeForces - 566D Restructuring Company(并查集记录区间边界)
D. Restructuring Companytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputEven the most successful company c原创 2017-07-22 14:12:49 · 531 阅读 · 0 评论 -
Codeforces Round #426 (Div. 2)The Meaningless Game(思维+二分)
lastyona 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 number k is chosen. Then, the one who says (or barks) it faster tha原创 2017-07-31 01:24:48 · 1109 阅读 · 0 评论 -
Codeforces Round #425 (Div. 2) B. Petya and Exam(字符串处理)
B. Petya and Examtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIt's hard times now. Today Petya needs to原创 2017-07-25 10:28:44 · 890 阅读 · 0 评论 -
Educational Codeforces Round 43 Well played!
Well played!Recently Max has got himself into popular CCG "BrainStone". As "BrainStone" is a pretty intellectual game, Max has to solve numerous hard problems during the gameplay. Here is one of them:...原创 2018-05-01 18:32:55 · 410 阅读 · 0 评论 -
CodeForces - 959E Mahmoud and Ehab and the xor-MST(异或)
Mahmoud and Ehab and the xor-MSTEhab is interested in the bitwise-xor operation and the special graphs. Mahmoud gave him a problem that combines both. He has a complete graph consisting of n vertices ...原创 2018-05-09 19:04:46 · 364 阅读 · 0 评论 -
CodeForces - 961E Tufurama(树状数组)
TufuramaOne day Polycarp decided to rewatch his absolute favourite episode of well-known TV series "Tufurama". He was pretty surprised when he got results only for season 7 episode 3 with his search q...原创 2018-05-09 22:07:36 · 394 阅读 · 0 评论 -
CodeForces 834D The Bakery(dp+线段树)
The BakerySome time ago Slastyona the Sweetmaid decided to open her own bakery! She bought required ingredients and a wonder-oven which can bake several types of cakes, and opened the bakery.Soon the ...原创 2018-06-05 22:38:30 · 241 阅读 · 0 评论 -
Codeforces Round #502 D
The Wutime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputChildan is making up a legendary story and trying to sell his forgery — a...原创 2018-08-09 00:45:23 · 259 阅读 · 0 评论 -
Codeforces Round #502 C
The Phone Numbertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputMrs. Smith is trying to contact her husband, John Smith, but she ...原创 2018-08-09 00:42:35 · 320 阅读 · 0 评论 -
CodeForces(503) 1019A Elections(枚举)
Elections time limit 2 secondsAs you know, maj...原创 2018-08-12 12:26:26 · 319 阅读 · 0 评论 -
codeforces 1025D (区间dp)
Recovering BST Time limit per test 1 se...原创 2018-08-21 12:23:10 · 694 阅读 · 0 评论 -
CodeForces - 401D Roman and Numbers(状压)
题目链接:http://codeforces.com/problemset/problem/401/D题意:问给出的数位的全排列组成的数当中,那些数模m等于0.思路:二进制表示选了哪些数,f[i][j]表示选了i表示的那些数,余数为j的方案数.直接状压DP或者记忆化搜索都可以,搜索比较好理解.代码:#include<bits/stdc++.h>#define m...原创 2018-11-30 10:45:04 · 326 阅读 · 0 评论 -
CodeForces - 1077F1 Pictures with Kittens (easy version)(DP)
题目链接:http://codeforces.com/problemset/problem/1077/F1题意:从n个物品中挑选x个物品,每个物品都有一个价值,我们想选出的价值尽量大,还有保证任意连续的k个物品中都至少有一个物品被选出来.思路:既然我们想选择x个物品,我们就可以令f[i][j]表示选择以第i个物品结尾的j个物品的最大价值.这样更新的话f[i][j] = max(f[...原创 2018-11-30 10:55:57 · 531 阅读 · 0 评论 -
CodeForces - 1077F1 Pictures with Kittens (hard version) (DP+双端队列)
题目链接:http://codeforces.com/problemset/problem/1077/F2题意:https://blog.csdn.net/nka_kun/article/details/84645060的增强版思路:我们根据上一题发现,其实更新f[i][j]的过程就是在f[i-1][j-1]到f[i-k][j-1]之间找一个最大值,用这个值来更新f[i][j].这里我...原创 2018-11-30 11:04:01 · 227 阅读 · 0 评论 -
Codeforces Round #428 (Div. 2) Journey(数学期望+dfs)
There are n cities and n - 1 roads in the Seven Kingdoms, each road connects two cities and we can reach any city from any other by the roads.Theon and Yara Greyjoy are on a horse in the first city, they are starting traveling through the roads. But the原创 2017-08-13 10:57:42 · 473 阅读 · 0 评论 -
Codeforces Round #428 (Div. 2) Game of the Rows (思维)
Daenerys Targaryen has an army consisting of k groups of soldiers, the i-th group contains ai soldiers. She wants to bring her army to the other side of the sea to get the Iron Throne. She has recently bought an airplane to carry her army through the sea.原创 2017-08-13 11:55:37 · 320 阅读 · 0 评论 -
Codeforces Round #433 (Div. 2) Planning (贪心+并查集)
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day.Metropolis airport is the main transport hub of Metro原创 2017-09-07 14:49:53 · 596 阅读 · 0 评论 -
Codeforces Round #432 (Div. 2)B题 (等弦对等弧)
Arpa is taking a geometry exam. Here is the last problem of the exam.You are given three points a, b, c.Find a point and an angle such that if we rotate the page around the point by the angle, the new position of a is the same as the old position of b,原创 2017-09-07 16:59:42 · 383 阅读 · 0 评论 -
Codeforces Round #409C Voltage Keepsake(二分)
C. Voltage Keepsaketime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have n devices that you want to use simultaneously.The i-th device uses ai units of power per second. This usage is continuo原创 2017-10-14 21:03:33 · 331 阅读 · 0 评论 -
Lengthening Sticks(容斥,组合数学)
Lengthening Stickstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given three sticks with positive integer lengths of a, b, and c centimeters. You can increase length of some of them by some原创 2017-11-04 13:44:34 · 424 阅读 · 0 评论 -
CF#119 Permutations(思维)
Permutationstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputHappy PMP is freshman and he is learning about algorithmic problems. He enjoys playing algorithmic games a lot.One of the seniors gave原创 2017-11-24 19:04:32 · 314 阅读 · 0 评论 -
CodeForces - 931D Peculiar apple-tree(思维)
Peculiar apple-treeIn Arcady's garden there grows a peculiar apple-tree that fruits one time per year. Its peculiarity can be explained in following way: there are n inflorescences, numbered from 1 to...原创 2018-03-09 12:31:48 · 312 阅读 · 0 评论 -
CodeForces - 140C New Year Snowmen(贪心)
New Year SnowmenAs meticulous Gerald sets the table and caring Alexander sends the postcards, Sergey makes snowmen. Each showman should consist of three snowballs: a big one, a medium one and a small ...原创 2018-03-05 16:34:17 · 383 阅读 · 0 评论 -
CodeForces - 635C XOR Equation(搜索||数论)
XOR EquationTwo positive integers a and b have a sum of s and a bitwise XOR of x. How many possible values are there for the ordered pair (a, b)?InputThe first line of the input contains two integers ...原创 2018-03-19 21:30:00 · 253 阅读 · 0 评论 -
CodeForces - 629C Famil Door and Brackets(dp)
Famil Door and BracketsAs Famil Door’s birthday is coming, some of his friends (like Gabi) decided to buy a present for him. His friends are going to buy a string consisted of round brackets since Fam...原创 2018-03-20 14:43:46 · 244 阅读 · 0 评论 -
CodeForces - 618D Hamiltonian Spanning Tree(思维)
Hamiltonian Spanning TreeA 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 tr...原创 2018-03-30 14:31:45 · 375 阅读 · 0 评论 -
CodeForces - 609D Gadgets for dollars and pounds(二分)
Gadgets for dollars and poundsNura wants to buy k gadgets. She has only s burles for that. She can buy each gadget for dollars or for pounds. So each gadget is selling only for some type of currency. ...原创 2018-03-22 11:17:18 · 353 阅读 · 0 评论 -
CodeForces960DFull Binary Tree Queries(二叉树的操作)
Full Binary Tree QueriesYou have a full binary tree having infinite levels.Each node has an initial value. If a node has value x, then its left child has value 2·x and its right child has value 2·x + ...原创 2018-04-14 22:30:29 · 596 阅读 · 0 评论 -
(Codeforces Round #413) Field expansion (搜索+思维优化)
In one of the games Arkady is fond of the game process happens on a rectangular field. In the game process Arkady can buy extensions for his field, each extension enlarges one of the field sizes in a particular number of times. Formally, there are n extens原创 2017-10-20 20:05:28 · 424 阅读 · 0 评论 -
CodeForces - 1077E Thematic Contests(二分好题)
题目链接:http://codeforces.com/problemset/problem/1077/E题意:给出n个题目,每个题目都有一个主题,现在让你安排若干场考试,每场考试的题目数量恰好是前一场的2倍,并且他们的主题是相同的,问最多能用掉多少题目?思路:我们想要用掉尽量多的题目,但是策略比较难定,因为用掉的题目多少跟我们第一场考试用掉的题目多少好像没有直接关系,为了产生这样的...原创 2018-11-30 12:42:51 · 407 阅读 · 0 评论