
codeforces
文章平均质量分 64
tokers
所有的魅力在“习惯”面前都将无色。
展开
-
Codeforces Round #306 (Div. 2)
A.给定一个字符串,问是否存在不重叠的两个串”AB”和”BA”,顺序任意.先从左到右遍历一遍,然后找出最靠左的”AB”的位置和”BA”的位置 然后从右往左遍历一遍,找出最靠右的”BA”的位置和”AB”的位置 然后比较一下就行了/************************************************************************* > File原创 2015-06-05 22:14:21 · 940 阅读 · 0 评论 -
Codeforces Round #218 (Div. 2)---D. Vessels(并查集)
There is a system of n vessels arranged one above the other as shown in the figure below. Assume that the vessels are numbered from 1 to n, in the order from the highest to the lowest, the volume of th原创 2015-04-09 21:45:31 · 868 阅读 · 0 评论 -
Codeforces Round #299 (Div. 2)
A题,水题,注意单词别打错了/************************************************************************* > File Name: CF-299-A.cpp > Author: ALex > Mail: zchao1995@gmail.com > Created Time: 2015年04月15原创 2015-04-15 18:21:28 · 1176 阅读 · 0 评论 -
Codeforces Round #177 (Div. 2)---E. Polo the Penguin and XOR operation(贪心)
Little penguin Polo likes permutations. But most of all he likes permutations of integers from 0 to n, inclusive.For permutation p = p0, p1, …, pn, Polo has defined its beauty — number .Expression mean原创 2015-04-08 16:56:22 · 1184 阅读 · 0 评论 -
Codeforces Round #177 (Div. 2)---D. Polo the Penguin and Houses (组合数学+暴力)
Little penguin Polo loves his home village. The village has n houses, indexed by integers from 1 to n. Each house has a plaque containing an integer, the i-th house has a plaque containing integer pi (原创 2015-04-08 19:27:28 · 2063 阅读 · 1 评论 -
SPOJ687---REPEATS - Repeats(后缀数组+RMQ)
A string s is called an (k,l)-repeat if s is obtained by concatenating k>=1 times some seed string t with length l>=1. For example, the strings = abaabaabaabais a (4,3)-repeat with t = aba as its seed原创 2015-04-07 19:43:33 · 908 阅读 · 0 评论 -
Codeforces Round #216 (Div. 2)---C. Valera and Elections
The city Valera lives in is going to hold elections to the city Parliament.The city has n districts and n - 1 bidirectional roads. We know that from any district there is a path along the roads to any原创 2015-04-07 12:11:17 · 936 阅读 · 0 评论 -
Codeforces Round #225 (Div. 2)---E. Propagating tree(时间戳+线段树)
Iahub likes trees very much. Recently he discovered an interesting tree named propagating tree. The tree consists of n nodes numbered from 1 to n, each node i having an initial value ai. The root of th原创 2015-04-22 11:14:38 · 1049 阅读 · 0 评论 -
ZeptoLab Code Rush 2015---C. Om Nom and Candies
A sweet little monster Om Nom loves candies very much. One day he found himself in a rather tricky situation that required him to think a bit in order to enjoy candies the most. Would you succeed with原创 2015-04-05 13:45:31 · 1823 阅读 · 0 评论 -
Codeforces Round #174 (Div. 2)---C. Cows and Sequence(操作序列)
Bessie and the cows are playing with sequences and need your help. They start with a sequence, initially containing just the number 0, and perform n operations. Each operation is one of the following:A原创 2015-04-10 16:12:23 · 909 阅读 · 0 评论 -
Codeforces Round #172 (Div. 2)---D. Maximum Xor Secondary(RMQ + 二分)
Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1, x2, …, xk (k > 1) is such maximum element xj, that the following in原创 2015-04-03 14:17:50 · 1122 阅读 · 0 评论 -
Codeforces Round #207 (Div. 2)---C. Knight Tournament(set乱搞)
C. Knight Tournamenttime limit per test 3 seconds memory limit per test 256megabytes input standard input output standard outputHooray! Berl II, the king of Berland is making a knight tournament. T原创 2015-04-20 21:01:43 · 885 阅读 · 0 评论 -
Codeforces Round #214 (Div. 2)---C. Dima and Salad
Dima, Inna and Seryozha have gathered in a room. That’s right, someone’s got to go. To cheer Seryozha up and inspire him to have a walk, Inna decided to cook something.Dima and Seryozha have n fruits i原创 2015-04-21 18:04:10 · 1183 阅读 · 0 评论 -
Codeforces Round #240 (Div. 1)---B.Mashmokh and ACM(dp)
Mashmokh’s boss, Bimokh, didn’t like Mashmokh. So he fired him. Mashmokh decided to go to university and participate in ACM instead of finding a new job. He wants to become a member of Bamokh’s team. I原创 2015-06-02 12:41:32 · 1149 阅读 · 0 评论 -
Codeforces Round #303 (Div. 2)
A.简单题/************************************************************************* > File Name: A.cpp > Author: ALex > Mail: zchao1995@gmail.com > Created Time: 2015年05月20日 星期三 09时51分15秒原创 2015-05-21 14:45:33 · 753 阅读 · 0 评论 -
Codeforces Round #305 (Div. 2)C---Mike and Frog(扩欧+乱搞)
Mike has a frog and a flower. His frog is named Xaniar and his flower is named Abol. Initially(at time 0), height of Xaniar is h1 and height of Abol is h2. Each second, Mike waters Abol and Xaniar.So,原创 2015-05-27 20:08:18 · 1218 阅读 · 0 评论 -
Codeforces Round #305 (Div. 2)D---Mike and Feet(单调栈)
Mike is the president of country What-The-Fatherland. There are n bears living in this country besides Mike. All of them are standing in a line and they are numbered from 1 to n from left to right. i-t原创 2015-05-27 20:09:25 · 970 阅读 · 0 评论 -
Codeforces Round #182 (Div. 2)---C. Yaroslav and Sequence(不错的题,分析找规律)
Yaroslav has an array, consisting of (2·n - 1) integers. In a single operation Yaroslav can change the sign of exactly n elements in the array. In other words, in one operation Yaroslav can select exac原创 2015-05-07 14:48:07 · 986 阅读 · 0 评论 -
Codeforces Round #174 (Div. 2)---D. Cow Program(dp, 记忆化搜索)
Farmer John has just given the cows a program to play with! The program contains two integer variables, x and y, and performs the following operations on a sequence a1, a2, …, an of positive integers:I原创 2015-05-06 16:09:19 · 1134 阅读 · 0 评论 -
Codeforces Round #179 (Div. 2)---D. Greg and Graph(离线+floyd)
Greg has a weighed directed graph, consisting of n vertices. In this graph any pair of distinct vertices has an edge between them in both directions. Greg loves playing with the graph and now he has in原创 2015-04-27 14:13:34 · 992 阅读 · 0 评论 -
Codeforces Round #301 (Div. 2)---D. Bad Luck Island(概率dp)
The Bad Luck Island is inhabited by three kinds of species: r rocks, s scissors and p papers. At some moments of time two random individuals meet (all pairs of individuals can meet equiprobably), and i原创 2015-05-02 11:58:04 · 814 阅读 · 0 评论 -
Codeforces Round #227 (Div. 2)---E. George and Cards(贪心, 树状数组+set维护, 好题!)
George is a cat, so he loves playing very much.Vitaly put n cards in a row in front of George. Each card has one integer written on it. All cards had distinct numbers written on them. Let’s number the原创 2015-04-29 18:34:07 · 974 阅读 · 0 评论 -
Codeforces Round #179 (Div. 2)---C. Greg and Array
Greg has an array a = a1, a2, …, an and m operations. Each operation looks as: li, ri, di, (1 ≤ li ≤ ri ≤ n). To apply operation i to the array means to increase all array elements with numbers li, li原创 2015-04-26 22:00:37 · 868 阅读 · 0 评论 -
Codeforces Round #170 (Div. 2)---C. Learning Languages(并查集)
The “BerCorp” company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee w原创 2015-04-03 12:35:54 · 1166 阅读 · 0 评论 -
Codeforces Beta Round #94 (Div. 1 Only)---A.Statues
In this task Anna and Maria play a game with a very unpleasant rival. Anna and Maria are in the opposite squares of a chessboard (8 × 8): Anna is in the upper right corner, and Maria is in the lower le原创 2015-03-24 21:10:03 · 669 阅读 · 0 评论 -
Codeforces Round #297 (Div. 2)---E. Anya and Cubes
Anya loves to fold and stick. Today she decided to do just that.Anya has n cubes lying in a line and numbered from 1 to n from left to right, with natural numbers written on them. She also has k sticke原创 2015-03-27 16:36:07 · 1032 阅读 · 0 评论 -
Codeforces Round #113 (Div. 2)---C. Median
A median in an array with the length of n is an element which occupies position number after we sort the elements in the non-decreasing order (the array elements are numbered starting with 1). A median原创 2015-03-26 19:45:13 · 651 阅读 · 0 评论 -
CF417D--- Cunning Gena(排序+状压dp)
A boy named Gena really wants to get to the “Russian Code Cup” finals, or at least get a t-shirt. But the offered problems are too complex, so he made an arrangement with his n friends that they will s原创 2015-03-16 13:32:49 · 1041 阅读 · 0 评论 -
Codeforces Round #226 (Div. 2) E---Bear in the Field(矩阵)
Our bear’s forest has a checkered field. The checkered field is an n × n table, the rows are numbered from 1 to n from top to bottom, the columns are numbered from 1 to n from left to right. Let’s deno原创 2015-03-19 16:38:47 · 1031 阅读 · 0 评论 -
Codeforces Round #103 (Div. 2)---C. Anagram Search
A string t is called an anagram of the string s, if it is possible to rearrange letters in t so that it is identical to the string s. For example, the string “aab” is an anagram of the string “aba” and原创 2015-03-25 10:46:47 · 1055 阅读 · 0 评论 -
Codeforces Round #294 (Div. 2)---E. A and B and Lecture Rooms
A and B are preparing themselves for programming contests.The University where A and B study is a set of rooms connected by corridors. Overall, the University has n rooms connected by n - 1 corridors s原创 2015-02-28 23:43:14 · 1179 阅读 · 0 评论 -
Codeforces Round #103 (Div. 2)---D. Missile Silos(最短路+枚举边)
A country called Berland consists of n cities, numbered with integer numbers from 1 to n. Some of them are connected by bidirectional roads. Each road has some length. There is a path from each city to原创 2015-03-25 19:04:23 · 803 阅读 · 0 评论 -
Codeforces Round #291 (Div. 2)---D. R2D2 and Droid Army
time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard outputAn army of n droids is lined up in one row. Each droid is described by m integers a1,原创 2015-02-15 15:18:52 · 1240 阅读 · 0 评论 -
Codeforces Round #293 (Div. 2)(A, B, C, D)
A: 模拟26进制加法即可/************************************************************************* > File Name: cf-293-a.cpp > Author: ALex > Mail: zchao1995@gmail.com > Created Time: 2015年02月25日原创 2015-02-25 15:35:07 · 1089 阅读 · 0 评论 -
Codeforces Beta Round #51---D. Beautiful numbers(数位dp, 巧妙)
Volodya is an odd boy and his taste is strange as well. It seems to him that a positive integer number is beautiful if and only if it is divisible by each of its nonzero digits. We will not argue with原创 2015-02-23 23:22:14 · 941 阅读 · 0 评论 -
Codeforces Round #165 (Div. 2)---D. Greenhouse Effect
Emuskald is an avid horticulturist and owns the world’s longest greenhouse — it is effectively infinite in length.Over the years Emuskald has cultivated n plants in his greenhouse, of m different plant原创 2015-03-28 12:43:09 · 882 阅读 · 0 评论 -
Codeforces Round #240 (Div. 1)B---Mashmokh and ACM(水dp)
Mashmokh’s boss, Bimokh, didn’t like Mashmokh. So he fired him. Mashmokh decided to go to university and participate in ACM instead of finding a new job. He wants to become a member of Bamokh’s team. I原创 2015-03-17 12:08:39 · 1498 阅读 · 0 评论 -
Codeforces Beta Round #75 (Div. 1 Only)---B.Queue
There are n walruses standing in a queue in an airport. They are numbered starting from the queue’s tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of t原创 2015-03-24 20:10:14 · 1014 阅读 · 0 评论 -
Codeforces Round #186 (Div. 2)---D. Ilya and Roads
Everything is great about Ilya’s city, except the roads. The thing is, the only ZooVille road is represented as n holes in a row. We will consider the holes numbered from 1 to n, from left to right.Ily原创 2015-04-02 20:16:33 · 740 阅读 · 0 评论 -
Codeforces Round #296 (Div. 1)B---Clique Problem
The clique problem is one of the most well-known NP-complete problems. Under some simplification it can be formulated as follows. Consider an undirected graph G. It is required to find a subset of vert原创 2015-03-18 21:24:04 · 906 阅读 · 0 评论