
常用技巧
文章平均质量分 73
小坏蛋_千千
im0qianqian_站在回忆的河边看着摇晃的渡船终年无声地摆渡,它们就这样安静地画下黄昏画下清晨......
展开
-
Codeforces 908 F. New Year and Rainbow Roads(思维)
Description Roy and Biv have a set of n points on the infinite number line. Each point has one of 3 colors: red, green, or blue. Roy and Biv would like to connect all the points with som...原创 2018-04-13 15:23:18 · 477 阅读 · 0 评论 -
HDU 5972 Regular Number (bitset)
Description Using regular expression to define a numeric string is a very common thing. Generally, use the shape as follows: (0|9|7) (5|6) (2) (4|5) Above regular expression matches 4 digit原创 2017-10-14 21:23:41 · 389 阅读 · 0 评论 -
Codeforces 122 D. Lucky Transformation (规律)
Description Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 ar原创 2017-10-31 14:58:08 · 606 阅读 · 0 评论 -
Codeforces 122 C. Lucky Sum(分块)
Description Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 ar原创 2017-10-31 14:39:11 · 404 阅读 · 0 评论 -
Codeforces 868 C. Qualification Rounds (技巧)
Description Snark and Philip are preparing the problemset for the upcoming pre-qualification round for semi-quarter-finals. They have a bank of n problems, and they want to select any non-empty subse原创 2017-10-05 21:30:11 · 915 阅读 · 3 评论 -
ACM 外挂模板技巧篇
ACM 外挂模板技巧篇原创 2017-10-04 18:47:29 · 1160 阅读 · 0 评论 -
51nod 1837 砝码称重 (规律)
Description 小 Q 有 n 个砝码,它们的质量分别为 1 克、 2 克、……、 n 克。 他给 i 克的砝码标上了编号 i (i = 1, 2, …, n),但是编号被人打乱了,即编号为 i 的砝码不一定是 i 克,而是 a_i 克,这里 a 指的是 1 到 n 的一个排列。 他有一杆天平,可以向天平的两侧放任意数量的砝码,通过一次称量得到两侧质量的大小关系,关系原创 2017-10-02 15:26:09 · 1245 阅读 · 4 评论 -
HDU 6085 Rikka with Candies (bitset)
Description As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them: There are n children and m kinds of can原创 2017-10-03 08:57:30 · 327 阅读 · 0 评论 -
Codeforces 847 H. Load Testing (技巧)
Description Polycarp plans to conduct a load testing of its new project Fakebook. He already agreed with his friends that at certain points in time they will send requests to Fakebook. The load testi原创 2017-09-30 16:17:34 · 707 阅读 · 0 评论 -
Codeforces 862 C. Mahmoud and Ehab and the xor (技巧)
Description Mahmoud and Ehab are on the third stage of their adventures now. As you know, Dr. Evil likes sets. This time he won’t show them any set from his large collection, but will ask them to cre原创 2017-09-20 18:06:18 · 1006 阅读 · 0 评论 -
Codeforces 847 B. Preparing for Merge Sort (二分)
Description Ivan has an array consisting of n different integers. He decided to reorder all elements in increasing order. Ivan loves merge sort so he decided to represent his array with one or severa原创 2017-09-28 13:46:45 · 724 阅读 · 0 评论 -
Codeforces 847 C. Sum of Nestings (技巧)
Description Recall that the bracket sequence is considered regular if it is possible to insert symbols ‘+’ and ‘1’ into it so that the result is a correct arithmetic expression. For example, a sequen原创 2017-09-28 09:00:00 · 529 阅读 · 0 评论 -
Codeforces 877 B. Nikita and string (技巧)
Description One day Nikita found the string containing letters “a” and “b” only. Nikita thinks that string is beautiful if it can be cut into 3 strings (possibly empty) without changing the orde原创 2017-10-26 12:39:48 · 681 阅读 · 0 评论 -
Codeforces 890 D. Restoration of string (技巧)
Description A substring of some string is called the most frequent, if the number of its occurrences is not less than number of occurrences of any other substring. You are given a set of strings原创 2017-11-17 15:26:38 · 613 阅读 · 0 评论 -
Codeforces 892 D. Gluttony (思维)
Description You are given an array a with n distinct integers. Construct an array b by permuting a such that for every non-empty subset of indices S = {x1, x2, …, xk} (1 ≤ xi ≤ n, 0 < k < n) the sums原创 2017-11-18 10:17:53 · 674 阅读 · 0 评论 -
TopCoder TCO 2018 Round 1A 500 (思维)
Problem Statement The Resistance is a multiplayer board game. During the game each player belongs into one of two groups: some are resistance members, others are spies. In this problem there are P...原创 2018-04-22 10:01:25 · 652 阅读 · 0 评论 -
ECNU 3337 我认识你 (思维)
Description 人与人之间的关系错综复杂,常常会出现一个叫作共同好友的东西。所以,贴心的 QQ 就提供了这样一个功能,可以显示你与某人(不一定是好友)有多少个共同好友。但是,当用户量逐渐增大,好友关系网不断复杂化,共同好友计算的效率就变得十分重要了。 你刚刚和腾讯公司签约,获得了共同好友计算的开发资格。 Input 第一行有两个整数 n,m...原创 2018-03-26 15:29:34 · 748 阅读 · 0 评论 -
Codeforces 714 C. Sonya and Queries (思维)
Description Today Sonya learned about long integers and invited all her friends to share the fun. Sonya has an initially empty multiset with integers. Friends give her t queries, each of one of th...原创 2018-03-20 21:22:08 · 383 阅读 · 0 评论 -
Codeforces 712 C. Memory and De-Evolution (思维)
Description Memory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side length x, and he wishes to perform operations to obtain ...原创 2018-03-20 20:59:01 · 316 阅读 · 0 评论 -
Codeforces 292 D. Connected Components (并查集)
Description We already know of the large corporation where Polycarpus works as a system administrator. The computer network there consists of n computers and m cables that connect some pairs of co原创 2018-02-07 16:34:40 · 413 阅读 · 0 评论 -
Codeforces 844 D. Interactive LowerBound (随机)
Description This is an interactive problem. You are given a sorted in increasing order singly linked list. You should find the minimum integer in the list which is greater than or equal to x....原创 2018-02-09 23:13:17 · 423 阅读 · 0 评论 -
Codeforces 844 C. Sorting by Subsequences (循环节)
Description You are given a sequence a1, a2, …, an consisting of different integers. It is required to split this sequence into the maximum number of subsequences such that after sorting integers ...原创 2018-02-09 22:39:47 · 352 阅读 · 0 评论 -
Codeforces 916 C. Jamie and Interesting Graph (构造)
Description Jamie has recently found undirected weighted graphs with the following properties very interesting: The graph is connected and contains exactly n vertices and m edges. All ed原创 2018-01-20 11:33:38 · 646 阅读 · 0 评论 -
FZU 2216 The Longest Straight (尺取法)
Description ZB is playing a card game where the goal is to make straights. Each card in the deck has a number between 1 and M(including 1 and M). A straight is a sequence of cards with consecutive原创 2018-01-27 22:47:05 · 274 阅读 · 0 评论 -
Codeforces 913 C. Party Lemonade (思维)
Description A New Year party is not a New Year party without lemonade! As usual, you are expecting a lot of guests, and buying lemonade has already become a pleasant necessity. Your favorite sto原创 2018-01-10 12:01:33 · 564 阅读 · 0 评论 -
Codeforces 892 B. Wrath (递推)
Description Hands that shed innocent blood! There are n guilty people in a line, the i-th of them holds a claw with length Li. The bell rings and every person kills some of people in front of hi原创 2017-11-18 11:45:18 · 1128 阅读 · 0 评论 -
Codeforces 849 D. Rooter's Song (技巧)
Description Wherever the destination is, whoever we meet, let’s render this song together. On a Cartesian coordinate plane lies a rectangular stage of size w × h, represented by a rectangle with原创 2017-09-02 14:18:57 · 960 阅读 · 0 评论 -
Codeforces 849 C. From Y to Y (技巧)
Description From beginning till end, this message has been waiting to be conveyed. For a given unordered multiset of n lowercase English letters (“multi” means that a letter may appear more than原创 2017-09-02 13:17:36 · 647 阅读 · 0 评论 -
ZOJ 3872 Beauty of Array (技巧)
Edward has an array A with N integers. He defines the beauty of an array as the summation of all distinct integers in the array. Now Edward wants to know the summation of the beauty of all contiguous s原创 2017-04-05 20:15:11 · 557 阅读 · 0 评论 -
HDU 4907 Task schedule (技巧)
Problem Description 有一台机器,并且给你这台机器的工作表,工作表上有n个任务,机器在ti时间执行第i个任务,1秒即可完成1个任务。 有m个询问,每个询问有一个数字q,表示如果在q时间有一个工作表之外的任务请求,请计算何时这个任务才能被执行。 机器总是按照工作表执行,当机器空闲时立即执行工作表之外的任务请求。Input 输入的第一行包含一个整数T, 表原创 2017-03-12 21:07:08 · 540 阅读 · 0 评论 -
HDU 4883 TIANKENG’s restaurant (最大覆盖数)
Problem Description TIANKENG manages a restaurant after graduating from ZCMU, and tens of thousands of customers come to have meal because of its delicious dishes. Today n groups of customers come to原创 2017-03-12 19:52:45 · 458 阅读 · 0 评论 -
HDU 4886 TIANKENG’s restaurant(Ⅱ) (哈希)
Problem Description After improving the marketing strategy, TIANKENG has made a fortune and he is going to step into the status of TuHao. Nevertheless, TIANKENG wants his restaurant to go internation原创 2017-03-19 11:13:33 · 579 阅读 · 0 评论 -
HDU 4908 BestCoder Sequence (哈希)
Problem Description Mr Potato is a coder. Mr Potato is the BestCoder. One night, an amazing sequence appeared in his dream. Length of this sequence is odd, the median number is M, and he na原创 2017-03-12 21:21:38 · 573 阅读 · 0 评论 -
POJ 1905 Expanding Rods (二分)
Description When a thin rod of length L is heated n degrees, it expands to a new length L’=(1+n*C)*L, where C is the coefficient of heat expansion. When a thin rod is mounted on two solid walls原创 2017-01-26 22:22:18 · 583 阅读 · 1 评论 -
POJ 3258 River Hopscotch (二分)
Description Every year the cows hold an event featuring a peculiar version of hopscotch that involves carefully jumping from rock to rock in a river. The excitement takes place on a long, straight ri原创 2017-01-28 12:35:39 · 1358 阅读 · 0 评论 -
POJ 3080 Blue Jeans (二分)
Description The Genographic Project is a research partnership between IBM and The National Geographic Society that is analyzing DNA from hundreds of thousands of contributors to map how the Earth was原创 2017-02-21 19:47:02 · 539 阅读 · 0 评论 -
POJ 3273 Monthly Expense (二分)
Description Farmer John is an astounding accounting wizard and has realized he might run out of money to run the farm. He has already calculated and recorded the exact amount of money (1 ≤ moneyi ≤ 1原创 2017-01-21 14:34:05 · 383 阅读 · 0 评论 -
POJ 1840 Eqs (哈希)
Description Consider equations having the following form: a1x13+a2x23+a3x33+a4x43+a5x53=0a1x1^3+ a2x2^3+ a3x3^3+ a4x4^3+ a5x5^3=0 The coefficients are given integers from the interval [-50原创 2017-02-27 19:37:38 · 554 阅读 · 0 评论 -
POJ 3122 Pie (二分)
Description My birthday is coming up and traditionally I’m serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to my party原创 2017-01-11 21:25:44 · 977 阅读 · 0 评论 -
ZOJ 3870 Team Formation (二进制)
Description For an upcoming programming contest, Edward, the headmaster of Marjar University, is forming a two-man team from N students of his university. Edward knows the skill level of each st原创 2017-04-05 21:01:48 · 703 阅读 · 0 评论