codeforces
bootdubbo
这个作者很懒,什么都没留下…
展开
-
B. The Meeting Place Cannot Be Changed【二分】
The main road in Bytecity is a straight line from south to north. Conveniently, there are coordinates measured in meters from the southernmost building in north direction.At some points on the road t...原创 2019-11-06 17:17:22 · 152 阅读 · 0 评论 -
D. Binary String Minimizing
You are given a binary string of length n (i. e. a string consisting of n characters ‘0’ and ‘1’).In one move you can swap two adjacent characters of the string. What is the lexicographically minimum...原创 2019-11-05 19:16:01 · 143 阅读 · 0 评论 -
D1. Toy Train (Simplified)
This is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.Alice received a set of Toy Train™ from Bob. It consists of ...原创 2019-08-30 20:49:04 · 101 阅读 · 0 评论 -
D2. Toy Train
Alice received a set of Toy Train™ from Bob. It consists of one train and a connected railway network of n stations, enumerated from 1 through n. The train occupies one station at a time and travels a...原创 2019-08-30 21:00:41 · 106 阅读 · 0 评论 -
Paint the Digits
You are given a sequence of n digits d1d2…dn. You need to paint all the digits in two colors so that:each digit is painted either in the color 1 or in the color 2;if you write in a row from left to ...原创 2019-09-16 22:18:22 · 184 阅读 · 0 评论 -
Paint the Numbers
You are given a sequence of integers a1,a2,…,an. You need to paint elements in colors, so that:If we consider any color, all elements of this color must be divisible by the minimal element of this co...原创 2019-09-16 23:11:06 · 222 阅读 · 0 评论 -
Koala and Lights
It is a holiday season, and Koala is decorating his house with cool lights! He owns n lights, all of which flash periodically.After taking a quick glance at them, Koala realizes that each of his ligh...原创 2019-09-16 23:13:10 · 391 阅读 · 0 评论 -
Yellow Cards
The final match of the Berland Football Cup has been held recently. The referee has shown n yellow cards throughout the match. At the beginning of the match there were a1 players in the first team and...原创 2019-09-18 23:16:28 · 318 阅读 · 0 评论 -
Uniqueness
You are given an array a1,a2,…,an. You can remove at most one subsegment from it. The remaining elements should be pairwise distinct.In other words, at most one time you can choose two integers l and...原创 2019-09-24 20:13:44 · 262 阅读 · 0 评论 -
Magic Grid【构造行列异或和相同】
Let us define a magic grid to be a square matrix of integers of size n×n, satisfying the following conditions.All integers from 0 to (n2−1) inclusive appear in the matrix exactly once.Bitwise XOR of...原创 2019-09-24 20:24:40 · 453 阅读 · 0 评论 -
Number Circle
You are given n numbers a1,a2,…,an. Is it possible to arrange them in a circle in such a way that every number is strictly less than the sum of its neighbors?For example, for the array [1,4,5,6,7,8],...原创 2019-09-24 21:05:43 · 335 阅读 · 0 评论 -
Painting the Fence
You have a long fence which consists of n sections. Unfortunately, it is not painted, so you decided to hire q painters to paint it. i-th painter will paint all sections x such that li≤x≤ri.Unfortuna...原创 2019-09-29 19:51:51 · 159 阅读 · 0 评论 -
Two Cakes
Sasha and Dima want to buy two n-tier cakes. Each cake should consist of n different tiers: from the size of 1 to the size of n. Tiers should go in order from the smallest to the biggest (from top to ...原创 2019-08-30 20:02:00 · 298 阅读 · 0 评论 -
Be Positive
You are given an array of n integers: a1,a2,…,an. Your task is to find some non-zero integer d (−103≤d≤103) such that, after each number in the array is divided by d, the number of positive numbers th...原创 2019-08-30 20:00:33 · 492 阅读 · 0 评论 -
D. Shortest Cycle
You are given n integer numbers a1,a2,…,an. Consider graph on n nodes, in which nodes i, j (i≠j) are connected if and only if, ai AND aj≠0, where AND denotes the bitwise AND operation.Find the length...原创 2019-08-22 13:35:03 · 263 阅读 · 0 评论 -
Sasha and His Trip
outputstandard outputSasha is a very happy guy, that’s why he is always on the move. There are n cities in the country where Sasha lives. They are all located on one straight line, and for convenienc...原创 2019-08-28 14:40:21 · 191 阅读 · 0 评论 -
Sasha and Magnetic Machines
outputstandard outputOne day Sasha visited the farmer 2D and his famous magnetic farm. On this farm, the crop grows due to the influence of a special magnetic field. Maintaining of the magnetic field...原创 2019-08-28 15:06:41 · 413 阅读 · 0 评论 -
Sasha and a Bit of Relax【*】
outputstandard outputSasha likes programming. Once, during a very long contest, Sasha decided that he was a bit tired and needed to relax. So he did. But since Sasha isn’t an ordinary guy, he prefers...原创 2019-08-28 16:09:57 · 157 阅读 · 0 评论 -
Sasha and One More Name【字符串暴力拼接判回文】
Reading books is one of Sasha’s passions. Once while he was reading one book, he became acquainted with an unusual character. The character told about himself like that: “Many are my names in many cou...原创 2019-08-28 17:03:29 · 259 阅读 · 0 评论 -
Best Subsegment
You are given array a1,a2,…,an. Find the subsegment al,al+1,…,ar (1≤l≤r≤n) with maximum arithmetic mean 1r−l+1∑i=lrai (in floating-point numbers, i.e. without any rounding).If there are many such sub...原创 2019-08-28 17:14:17 · 342 阅读 · 0 评论 -
Emotes
outputstandard outputThere are n emotes in very popular digital collectible card game (the game is pretty famous so we won’t say its name). The i-th emote increases the opponent’s happiness by ai uni...原创 2019-08-28 21:05:41 · 418 阅读 · 0 评论 -
Draw!
You still have partial information about the score during the historic football match. You are given a set of pairs (ai,bi), indicating that at some point during the match the score was “ai: bi”. It i...原创 2019-08-30 15:43:33 · 122 阅读 · 0 评论 -
Birthday
Cowboy Vlad has a birthday today! There are n children who came to the celebration. In order to greet Vlad, the children decided to form a circle around him. Among the children who came, there are bot...原创 2019-08-30 16:00:15 · 132 阅读 · 0 评论 -
Asya And Kittens【并查集*】
Asya loves animals very much. Recently, she purchased n kittens, enumerated them from 1 and n and then put them into the cage. The cage consists of one row of n cells, enumerated with integers from 1 ...原创 2019-08-30 16:54:06 · 205 阅读 · 0 评论 -
Connect【BFS】
Alice lives on a flat planet that can be modeled as a square grid of size n×n, with rows and columns enumerated from 1 to n. We represent the cell at the intersection of row r and column c with ordere...原创 2019-08-30 19:52:50 · 225 阅读 · 0 评论 -
codeforces D. White Lines
Gildong has bought a famous painting software cfpaint. The working screen of cfpaint is square-shaped consisting of n rows and n columns of square cells. The rows are numbered from 1 to n, from top to...原创 2019-08-12 22:50:43 · 230 阅读 · 0 评论