
CF
文章平均质量分 81
--Simone-
这个作者很懒,什么都没留下…
展开
-
Hacking Cypher(数学)
ing into a new secure messenger. He's almost won.Having carefully studied the interaction protocol, Polycarpus came to the conclusion that the secret key can be obtained if he properly cuts the public key of the application into two parts. The public key原创 2014-11-29 17:26:16 · 177 阅读 · 0 评论 -
Plant(矩阵快速幂)
triangle directed "upwards". This plant has an amusing feature. After one year a triangle plant directed "upwards" divides into four triangle plants: three of them will point "upwards" and one will point "downwards".原创 2014-08-04 10:18:27 · 100 阅读 · 0 评论 -
Jzzhu and Chocolate(贪心)
at consists of n × m unit squares. He wants to cut this bar exactly k times. Each cut must meet the following requirements:each cut should be straight (horizontal or vertical);each cut should go along edges of unit squares (it is prohibited to divide原创 2014-07-21 23:04:16 · 77 阅读 · 0 评论 -
Multiplication Table(二分搜索)
also is very smart.While some of us were learning the multiplication table, Bizon the Champion had fun in his own manner. Bizon the Champion painted ann × m multiplication table, where the element on the intersection of the i-th row and j-th column equal原创 2014-07-18 15:01:24 · 104 阅读 · 0 评论 -
Painting Fence(分治)
is very hardworking.Bizon the Champion decided to paint his old fence his favorite color, orange. The fence is represented as n vertical planks, put in a row. Adjacent planks have no gap between them. The planks are numbered from the left to the right st原创 2014-07-18 14:32:20 · 487 阅读 · 0 评论 -
Pawn(DP)
a pawn. It has only two variants of moving: upwards and leftwards or upwards and rightwards. The pawn can choose from which square of the lowest row it can start its journey. On each square lay from 0 to 9 peas. The pawn wants to reach the uppermost row ha原创 2014-07-17 00:26:01 · 105 阅读 · 0 评论 -
Codeforces World Finals(模拟)
bout the Codeforces site, which is rapidly getting more and more popular among the brightest minds of the humanity, who are using it for training and competing. Recently Copa understood that to conquer the world he needs to organize the world Codeforces to原创 2014-07-16 11:56:10 · 152 阅读 · 0 评论 -
Enemy is weak(树状数组 + 离散化)
e much more than the Persians but Shapur is ready to defeat them. He says: "A lion is never afraid of a hundred sheep".Nevertheless Shapur has to find weaknesses in the Roman army to defeat them. So he gives the army a weakness number.In Shap原创 2014-07-16 11:49:56 · 155 阅读 · 0 评论 -
Valera and Fruits(贪心)
grow.This year he will enjoy a great harvest! On the i-th tree bi fruit grow, they will ripen on a day number ai. Unfortunately, the fruit on the tree get withered, so they can only be collected on day ai and day ai + 1 (all fruits that are not collecte原创 2014-07-09 13:33:48 · 94 阅读 · 0 评论 -
XOR on Segment(线段树)
rs a1, a2, ..., an. You are allowed to perform two operations on this array:Calculate the sum of current array elements on the segment [l, r], that is, count value al + al + 1 + ... + ar.Apply the xor operation with a given number x to each array elem原创 2014-06-04 21:46:43 · 332 阅读 · 0 评论 -
Checkposts(强连通 + Tarjan)
原创 2014-05-03 15:53:11 · 112 阅读 · 0 评论 -
Magic Formulas(数学)
s very much. You can see some of them below.Imagine you are given a sequence of positive integer numbers p1, p2, ..., pn. Lets write down some magic formulas:Here, "mod" means the operation of taking the residue after dividing.The expres原创 2014-04-27 17:39:54 · 195 阅读 · 0 评论 -
Ivan and Powers of Two(杂)
integers a1, a2, ..., an. Ivan knows that the array is sorted in the non-decreasing order.Ivan wrote out integers 2a1, 2a2, ..., 2an on a piece of paper. Now he wonders, what minimum number of integers of form 2b (b ≥ 0)need to be added to the piece of原创 2014-08-05 10:24:17 · 111 阅读 · 0 评论 -
Boredom(DP)
ored, he comes up with games. One long winter evening he came up with a game and decided to play it.Given a sequence a consisting of n integers. The player can make several steps. In a single step he can choose an element of the sequence (let's denote it原创 2014-08-09 10:33:40 · 109 阅读 · 0 评论 -
Diverse Permutation(构造)
s p1, p2, ..., pn, consisting of n distinct positive integers not larger than n. We'll denote as n the length of permutation p1, p2, ..., pn.Your task is to find such permutation p of length n, that the group of numbers |p1 - p2|, |p2 - p3|,原创 2014-11-29 14:06:55 · 204 阅读 · 0 评论 -
Flowers(DP)
Now it's Marmot's dinner time and, as we all know, Marmot eats flowers. At every dinner he eats some red and white flowers. Therefore a dinner can be represented as a sequence of several flowers, some of them white and some of them red.But, for a dinner原创 2014-11-29 11:50:41 · 125 阅读 · 0 评论 -
24 Game(数学构造)
recently he has found it too easy. So he invented a new game.Initially you have a sequence of n integers: 1, 2, ..., n. In a single step, you can pick two of them, let's denote them a and b, erase them from the sequence, and append to the sequence either原创 2014-09-23 17:15:03 · 119 阅读 · 0 评论 -
Information Graph(并查集)
(let's number them from 1 to n for convenience). Initially the employees didn't have any relationships among each other. On each of m next days one of the following events took place:either employee y became the boss of employee x (at that, employee x原创 2014-09-18 18:06:36 · 110 阅读 · 0 评论 -
Pashmak and Flowers(模拟)
owers from the garden. There are n flowers in the garden and the i-th of them has a beauty number bi. Parmida is a very strange girl so she doesn't want to have the two most beautiful flowers necessarily. She wants to have those pairs of flowers that their原创 2014-08-22 10:16:40 · 133 阅读 · 0 评论 -
Pashmak and Garden(模拟)
girl called Parmida since one year ago...Today, Pashmak set up a meeting with his partner in a romantic garden. Unfortunately, Pashmak has forgotten where the garden is. But he remembers that the garden looks like a square with sides parallel to the coo原创 2014-08-22 10:13:58 · 93 阅读 · 0 评论 -
DZY Loves Chessboard(杂)
with it.He has a chessboard of n rows and m columns. Some cells of the chessboard are bad, others are good. For every good cell, DZY wants to put a chessman on it. Each chessman is either white or black. After putting all chessmen, DZY wants that no two原创 2014-08-11 09:57:00 · 102 阅读 · 0 评论 -
Count Good Substrings(数学)
all the consecutive equal characters, the resulting string is palindrome. For example, "aabba" is good, because after the merging step it will become "aba".Given a string, you have to find two values:the number of good substrings o原创 2014-08-10 17:17:08 · 89 阅读 · 0 评论 -
Predict Outcome of the Game(数学)
ournament. Three teams are participating in it. Currently k games had already been played.You are an avid football fan, but recently you missed the whole k games. Fortunately, you remember a guess of your friend for these kgames. Your friend did not tell原创 2014-08-10 15:18:42 · 104 阅读 · 0 评论 -
Little Pony and Expected Maximum(数学概率)
udo with her friends Rainbow Dash, Apple Jack and Flutter Shy. But she kept losing. Having returned to the castle, Twilight Sparkle became interested in the dice that were used in the game.The dice has m faces: the first face of the dice contains a dot,原创 2014-08-10 11:16:24 · 124 阅读 · 0 评论 -
Domino Principle(排序)
is fed up with common dominoes and he uses the dominoes of different heights. He put ndominoes on the table along one axis, going from left to right. Every domino stands perpendicular to that axis so that the axis passes through the center of its base. The原创 2014-08-09 23:04:14 · 139 阅读 · 0 评论 -
Elimination(数学)
in 2214 will be the participants who win in one of the elimination rounds.The elimination rounds are divided into main and additional. Each of the main elimination rounds consists of c problems, the winners of the round are the first n people in the rati原创 2014-04-18 20:52:01 · 390 阅读 · 0 评论 -
Kicker(分析模拟)
, in which players control the footballers' figures mounted on rods by using bars to get the ball into the opponent's goal. When playing two on two, one player of each team controls the goalkeeper and the full-backs (plays defence), the other player contro原创 2014-04-16 23:15:32 · 175 阅读 · 0 评论 -
Very Beautiful Number(技巧枚举)
ress. Now we are even allowed to use decimal notation instead of counting sticks. After the test the teacher promised to show us a "very beautiful number". But the problem is, he's left his paper with the number in the teachers' office.The teac原创 2014-02-22 15:25:48 · 100 阅读 · 0 评论 -
Fox and Box Accumulation(模拟)
ey have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the strength of the box).Since all the boxes have the same size, Ciel cannot put more than one box directly on the原创 2014-02-06 21:33:46 · 120 阅读 · 0 评论 -
George and Sleep(时间计算)
the digital clock. Besides, George knows that he has slept for time t.Help George! Write a program that will, given time s and t, determine the time p when George went to bed. Note that George could have gone to bed yesterday relatively to the current t原创 2014-01-31 13:50:50 · 99 阅读 · 0 评论 -
Bear and Prime NumbersSX(素数筛选)
a structures and faced the following problem.You are given a sequence of integers x1, x2, ..., xn of length n and m queries, each of them is characterized by two integers li, ri. Let's introduce f(p) to represent the number of such indexes k, that xk is原创 2014-01-27 17:10:58 · 89 阅读 · 0 评论 -
Bear and Strings(技巧统计)
(record |s| is the string's length), consisting of lowercase English letters. The bear wants to count the number of such pairs of indices i, j (1 ≤ i ≤ j ≤ |s|), that string x(i, j) = sisi + 1... sj contains at least one string "bear" as a substr原创 2014-01-27 13:41:03 · 138 阅读 · 0 评论 -
Semifinals(技巧模拟)
ent. Each semifinal had n participants. There are n participants advancing to the finals, they are chosen as follows: from each semifinal, we choose k people (0 ≤ 2k ≤ n) who showed the best result in their semifinals and all other places in the finals go原创 2014-01-27 13:27:36 · 139 阅读 · 0 评论 -
Number Busters(数学)
hey've got a competition.Arthur took a group of four integers a, b, w, x (0 ≤ b < w, 0 < x < w) and Alexander took integer с. Arthur and Alexander use distinct approaches to number bustings. Alexander is just a regular guy. Each seco原创 2014-01-24 21:56:06 · 95 阅读 · 0 评论 -
Sereja and Stairs(模拟 + STL)
especially likes stairs.Sequence a1, a2, ..., a|a| (|a| is the length of the sequence) is stairs if there is such index i (1 ≤ i ≤ |a|), that the following condition is met:a1 < a2 < ... < ai - 1 < ai > ai + 1 &g原创 2014-01-23 13:54:32 · 113 阅读 · 0 评论 -
Multitasking(模拟)
In order to do this, he wants to sort n arrays simultaneously, each array consisting of mintegers.Iahub can choose a pair of distinct indices i and j (1 ≤ i, j ≤ m, i ≠ j). Then in each array the values at positions i and j are swapped only if the value原创 2014-01-21 22:03:12 · 272 阅读 · 0 评论 -
New Year Ratings Change(贪心)
ite (let's call it X) has come up with a New Year adventure. Specifically, they decided to give ratings to all visitors.There are n users on the site, for each user we know the rating value he wants to get as a New Year Present. We know that user i wants原创 2014-01-08 17:32:32 · 78 阅读 · 0 评论 -
Valera and Contest(模拟)
ons. Especially in programming contests. Today he has participated in the contest with his team, consisting of n students (including Valera). This contest was an individual competition, so each student in the team solved problems individually.After the c原创 2013-11-30 10:02:47 · 103 阅读 · 0 评论 -
Dominoes(贪心)
s. Our box with Domino was empty, so we decided to borrow the teacher's dominoes.The teacher responded instantly at our request. He put nm dominoes on the table as an n × 2m rectangle so that each of the n rows contained m dominoes arranged horizontally.原创 2014-02-22 19:00:33 · 103 阅读 · 0 评论 -
On Segment's Own Points(模拟)
ed the University of City N — the Berland capital. Alexey expected his father to get him a place to live in but his father said it was high time for Alexey to practice some financial independence. So, Alexey is living in a dorm.The dorm has exactly one s原创 2014-02-27 20:10:28 · 92 阅读 · 0 评论