task
stringlengths
0
154k
__index_level_0__
int64
0
39.2k
Title: ...Wait for it... Time Limit: None seconds Memory Limit: None megabytes Problem Description: Barney is searching for his dream girl. He lives in NYC. NYC has *n* junctions numbered from 1 to *n* and *n*<=-<=1 roads connecting them. We will consider the NYC as a rooted tree with root being junction 1. *m* girl...
500
Title: Luba And The Ticket Time Limit: None seconds Memory Limit: None megabytes Problem Description: Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make th...
501
Title: Simple XML Time Limit: None seconds Memory Limit: None megabytes Problem Description: Let's define a string &lt;x&gt; as an opening tag, where *x* is any small letter of the Latin alphabet. Each opening tag matches a closing tag of the type &lt;/x&gt;, where *x* is the same letter. Tegs can be nested into ea...
502
Title: Sleuth Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Vasya plays the sleuth with his friends. The rules of the game are as follows: those who play for the first time, that is Vasya is the sleuth, he should investigate a "crime" and find out what is happening. He can ask any questions ...
503
Title: Igor In the Museum Time Limit: None seconds Memory Limit: None megabytes Problem Description: Igor is in the museum and he wants to see as many pictures as possible. Museum can be represented as a rectangular field of *n*<=Γ—<=*m* cells. Each cell is either empty or impassable. Empty cells are marked with '.'...
504
Title: Santa Claus and Robot Time Limit: None seconds Memory Limit: None megabytes Problem Description: Santa Claus has Robot which lives on the infinite grid and can move along its lines. He can also, having a sequence of *m* points *p*1,<=*p*2,<=...,<=*p**m* with integer coordinates, do the following: denote its i...
505
Title: Valera and Contest Time Limit: None seconds Memory Limit: None megabytes Problem Description: Valera loves to participate in competitions. 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 c...
506
Title: Vanya and Scales Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vanya has a scales for weighing loads and weights of masses *w*0,<=*w*1,<=*w*2,<=...,<=*w*100 grams where *w* is some integer not less than 2 (exactly one weight of each nominal value). Vanya wonders whether he can wei...
507
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Stepan has the newest electronic device with a display. Different digits can be shown on it. Each digit is shown on a seven-section indicator like it is shown on the picture below. So, for example, to show the digit 3 on the disp...
508
Title: Credit Card Time Limit: None seconds Memory Limit: None megabytes Problem Description: Recenlty Luba got a credit card and started to use it. Let's consider *n* consecutive days Luba uses the card. She starts with 0 money on her account. In the evening of *i*-th day a transaction *a**i* occurs. If *a**i*<=&...
509
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: 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 vertices *C* of the maximum siz...
510
Title: Cycle In Maze Time Limit: None seconds Memory Limit: None megabytes Problem Description: The Robot is in a rectangular maze of size *n*<=Γ—<=*m*. Each cell of the maze is either empty or occupied by an obstacle. The Robot can move between neighboring cells on the side left (the symbol "L"), right (the symbol "...
511
Title: EKG Time Limit: None seconds Memory Limit: None megabytes Problem Description: In the rush of modern life, people often forget how beautiful the world is. The time to enjoy those around them is so little that some even stand in queues to several rooms at the same time in the clinic, running from one queue to ...
512
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Group of Berland scientists, with whom you have a close business relationship, makes a research in the area of peaceful nuclear energy. In particular, they found that a group of four nanobots, placed on a surface of a plate, can r...
513
Title: Expression Queries Time Limit: None seconds Memory Limit: None megabytes Problem Description: A simplified arithmetic expression (SAE) is an arithmetic expression defined by the following grammar: - &lt;SAE&gt; ::= &lt;Number&gt; | &lt;SAE&gt;+&lt;SAE&gt; | &lt;SAE&gt;*&lt;SAE&gt; | (&lt;SAE&gt;) - &lt;Num...
514
Title: Supermarket Time Limit: None seconds Memory Limit: None megabytes Problem Description: We often go to supermarkets to buy some fruits or vegetables, and on the tag there prints the price for a kilo. But in some supermarkets, when asked how much the items are, the clerk will say that $a$ yuan for $b$ kilos (Yo...
515
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: In some country live wizards. They love playing with numbers. The blackboard has two numbers written on it β€” *a* and *b*. The order of the numbers is not important. Let's consider *a*<=≀<=*b* for the sake of definiteness. The pl...
516
Title: Optimal Point Time Limit: None seconds Memory Limit: None megabytes Problem Description: When the river brought Gerda to the house of the Old Lady who Knew Magic, this lady decided to make Gerda her daughter. She wants Gerda to forget about Kay, so she puts all the roses from the garden underground. Mole, wh...
517
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given several queries. Each query consists of three integers $p$, $q$ and $b$. You need to answer whether the result of $p/q$ in notation with base $b$ is a finite fraction. A fraction in notation with base $b$ is finite ...
518
Title: Ruminations on Ruminants Time Limit: None seconds Memory Limit: None megabytes Problem Description: Kevin Sun is ruminating on the origin of cows while standing at the origin of the Cartesian plane. He notices *n* lines on the plane, each representable by an equation of the form *ax*<=+<=*by*<==<=*c*. He als...
519
Title: Hit Ball Time Limit: None seconds Memory Limit: None megabytes Problem Description: When Valera was playing football on a stadium, it suddenly began to rain. Valera hid in the corridor under the grandstand not to get wet. However, the desire to play was so great that he decided to train his hitting the ball r...
520
Title: Success Rate Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made *y* submissions, out of which *x* have been successful. Thus, your current success rate on Codeforces is equ...
521
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: The country Treeland consists of *n* cities connected with *n*<=-<=1 bidirectional roads in such a way that it's possible to reach every city starting from any other city using these roads. There will be a soccer championship next...
522
Title: Notepad Time Limit: 2 seconds Memory Limit: 64 megabytes Problem Description: Nick is attracted by everything unconventional. He doesn't like decimal number system any more, and he decided to study other number systems. A number system with base *b* caught his attention. Before he starts studying it, he wants...
523
Title: Polo the Penguin and Strings Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little penguin Polo adores strings. But most of all he adores strings of length *n*. One day he wanted to find a string that meets the following conditions: 1. The string consists of *n* lowercase Englis...
524
Title: Rosetta Problem Time Limit: None seconds Memory Limit: None megabytes Problem Description: Input Specification: The input contains a single integer *a* (0<=≀<=*a*<=≀<=1<=000<=000). Output Specification: Output a single integer. Demo Input: ['129\n'] Demo Output: ['1\n'] Note: none
525
Title: Gifts Time Limit: None seconds Memory Limit: None megabytes Problem Description: Once upon a time an old man and his wife lived by the great blue sea. One day the old man went fishing and caught a real live gold fish. The fish said: "Oh ye, old fisherman! Pray set me free to the ocean and I will grant you wit...
526
Title: Lucky Tickets Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Vasya thinks that lucky tickets are the tickets whose numbers are divisible by 3. He gathered quite a large collection of such tickets but one day his younger brother Leonid was having a sulk and decided to destroy the collec...
527
Title: Little Elephant and Numbers Time Limit: None seconds Memory Limit: None megabytes Problem Description: The Little Elephant loves numbers. He has a positive integer *x*. The Little Elephant wants to find the number of positive integers *d*, such that *d* is the divisor of *x*, and *x* and *d* have at least o...
528
Title: Yaroslav and Points Time Limit: None seconds Memory Limit: None megabytes Problem Description: Yaroslav has *n* points that lie on the *Ox* axis. The coordinate of the first point is *x*1, the coordinate of the second point is *x*2, ..., the coordinate of the *n*-th point is β€” *x**n*. Now Yaroslav wants to ex...
529
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: DZY loves colors, and he enjoys painting. On a colorful day, DZY gets a colorful ribbon, which consists of *n* units (they are numbered from 1 to *n* from left to right). The color of the *i*-th unit of the ribbon is *i* at first...
530
Title: Laboratory Work Time Limit: None seconds Memory Limit: None megabytes Problem Description: Anya and Kirill are doing a physics laboratory work. In one of the tasks they have to measure some value *n* times, and then compute the average value to lower the error. Kirill has already made his measurements, and h...
531
Title: Masha and geometric depression Time Limit: None seconds Memory Limit: None megabytes Problem Description: Masha really loves algebra. On the last lesson, her strict teacher Dvastan gave she new exercise. You are given geometric progression *b* defined by two integers *b*1 and *q*. Remind that a geometric pro...
532
Title: Without Text Time Limit: None seconds Memory Limit: None megabytes Problem Description: You can preview the image in better quality by the link: [http://assets.codeforces.com/files/656/without-text.png](//assets.codeforces.com/files/656/without-text.png) Input Specification: The only line of the input is a s...
533
Title: Lengthening Sticks Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given three sticks with positive integer lengths of *a*,<=*b*, and *c* centimeters. You can increase length of some of them by some positive integer number of centimeters (different sticks can be increased by...
534
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: A remote island chain contains *n* islands, labeled 1 through *n*. Bidirectional bridges connect the islands to form a simple cycleΒ β€” a bridge connects islands 1 and 2, islands 2 and 3, and so on, and additionally a bridge connect...
535
Title: Lazy Security Guard Time Limit: None seconds Memory Limit: None megabytes Problem Description: Your security guard friend recently got a new job at a new security company. The company requires him to patrol an area of the city encompassing exactly *N* city blocks, but they let him choose which blocks. That is...
536
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: There have recently been elections in the zoo. Overall there were 7 main political parties: one of them is the Little Elephant Political Party, 6 other parties have less catchy names. Political parties find their number in the ba...
537
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem 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 once), we treat all letters as strings of le...
538
Title: Martian Strings Time Limit: None seconds Memory Limit: None megabytes Problem Description: During the study of the Martians Petya clearly understood that the Martians are absolutely lazy. They like to sleep and don't like to wake up. Imagine a Martian who has exactly *n* eyes located in a row and numbered f...
539
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Little Artem is fond of dancing. Most of all dances Artem likes ruedaΒ β€” Cuban dance that is danced by pairs of boys and girls forming a circle and dancing together. More detailed, there are *n* pairs of boys and girls standing in...
540
Title: Two Squares Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given two squares, one with sides parallel to the coordinate axes, and another one with sides at 45 degrees to the coordinate axes. Find whether the two squares intersect. The interior of the square is considered t...
541
Title: Online Courses In BSU Time Limit: None seconds Memory Limit: None megabytes Problem Description: Now you can take online courses in the Berland State University! Polycarp needs to pass *k* main online courses of his specialty to get a diploma. In total *n* courses are availiable for the passage. The situatio...
542
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Twilight Sparkle learnt that the evil Nightmare Moon would return during the upcoming Summer Sun Celebration after one thousand years of imprisonment on the moon. She tried to warn her mentor Princess Celestia, but the princess ig...
543
Title: Digits Permutations Time Limit: None seconds Memory Limit: None megabytes Problem Description: Andrey's favourite number is *n*. Andrey's friends gave him two identical numbers *n* as a New Year present. He hung them on a wall and watched them adoringly. Then Andrey got bored from looking at the same number ...
544
Title: Dorm Water Supply Time Limit: 1 seconds Memory Limit: 256 megabytes Problem Description: The German University in Cairo (GUC) dorm houses are numbered from 1 to *n*. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow only in this direction and not vice versa...
545
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Iahub is a big fan of tourists. He wants to become a tourist himself, so he planned a trip. There are *n* destinations on a straight road that Iahub wants to visit. Iahub starts the excursion from kilometer 0. The *n* destinations...
546
Title: Tree-String Problem Time Limit: None seconds Memory Limit: None megabytes Problem Description: A rooted tree is a non-directed connected graph without any cycles with a distinguished vertex, which is called the tree root. Consider the vertices of a rooted tree, that consists of *n* vertices, numbered from 1 t...
547
Title: Tram Time Limit: None seconds Memory Limit: None megabytes Problem Description: Linear Kingdom has exactly one tram line. It has *n* stops, numbered from 1 to *n* in the order of tram's movement. At the *i*-th stop *a**i* passengers exit the tram, while *b**i* passengers enter it. The tram is empty before it ...
548
Title: Bear and Chemistry Time Limit: None seconds Memory Limit: None megabytes Problem Description: Limak is a smart brown bear who loves chemistry, reactions and transforming elements. In Bearland (Limak's home) there are *n* elements, numbered 1 through *n*. There are also special machines, that can transform el...
549
Title: Graph Game Time Limit: None seconds Memory Limit: None megabytes Problem Description: In computer science, there is a method called "Divide And Conquer By Node" to solve some hard problems about paths on a tree. Let's desribe how this method works by function: *solve*(*t*) (*t* is a tree): 1. Chose a node...
550
Title: Parking Lot Time Limit: None seconds Memory Limit: None megabytes Problem Description: To quickly hire highly skilled specialists one of the new IT City companies made an unprecedented move. Every employee was granted a car, and an employee can choose one of four different car makes. The parking lot before t...
551
Title: Card Game Again Time Limit: None seconds Memory Limit: None megabytes Problem Description: Vova again tries to play some computer card game. The rules of deck creation in this game are simple. Vova is given an existing deck of *n* cards and a magic number *k*. The order of the cards in the deck is fixed. Eac...
552
Title: Code obfuscation Time Limit: None seconds Memory Limit: None megabytes Problem Description: Kostya likes Codeforces contests very much. However, he is very disappointed that his solutions are frequently hacked. That's why he decided to obfuscate (intentionally make less readable) his code before upcoming cont...
553
Title: Ksenia and Pan Scales Time Limit: None seconds Memory Limit: None megabytes Problem Description: Ksenia has ordinary pan scales and several weights of an equal mass. Ksenia has already put some weights on the scales, while other weights are untouched. Ksenia is now wondering whether it is possible to put all ...
554
Title: A and B and Chess Time Limit: None seconds Memory Limit: None megabytes Problem Description: A and B are preparing themselves for programming contests. To train their logical thinking and solve problems better, A and B decided to play chess. During the game A wondered whose position is now stronger. For eac...
555
Title: Greg and Array Time Limit: None seconds Memory Limit: None megabytes Problem Description: Greg has an array *a*<==<=*a*1,<=*a*2,<=...,<=*a**n* and *m* operations. Each operation looks as: *l**i*, *r**i*, *d**i*, (1<=≀<=*l**i*<=≀<=*r**i*<=≀<=*n*). To apply operation *i* to the array means to increase all array...
556
Title: Boredom Time Limit: None seconds Memory Limit: None megabytes Problem Description: Alex doesn't like boredom. That's why whenever he gets bored, 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 ...
557
Title: Wall Bars Time Limit: None seconds Memory Limit: None megabytes Problem Description: Manao is working for a construction company. Recently, an order came to build wall bars in a children's park. Manao was commissioned to develop a plan of construction, which will enable the company to save the most money. Af...
558
Title: Timofey and rectangles Time Limit: None seconds Memory Limit: None megabytes Problem Description: One of Timofey's birthday presents is a colourbook in a shape of an infinite plane. On the plane *n* rectangles with sides parallel to coordinate axes are situated. All sides of the rectangles have odd length. Re...
559
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Hongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries. The world can be modeled as an undirected graph with *n* nodes and *m* edges. *k* of the no...
560
Title: Tree Time Limit: None seconds Memory Limit: None megabytes Problem Description: You are given a node of the tree with index 1 and with weight 0. Let *cnt* be the number of nodes in the tree at any instant (initially, *cnt* is set to 1). Support *Q* queries of following two types: - Add a new node (index *c...
561
Title: Testing Pants for Sadness Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: The average miner Vaganych took refresher courses. As soon as a miner completes the courses, he should take exams. The hardest one is a computer test called "Testing Pants for Sadness". The test consists of *n* q...
562
Title: The Monster and the Squirrel Time Limit: None seconds Memory Limit: None megabytes Problem Description: Ari the monster always wakes up very early with the first ray of the sun and the first thing she does is feeding her squirrel. Ari draws a regular convex polygon on the floor and numbers it's vertices 1,<=...
563
Title: Bears and Juice Time Limit: None seconds Memory Limit: None megabytes Problem Description: There are *n* bears in the inn and *p* places to sleep. Bears will party together for some number of nights (and days). Bears love drinking juice. They don't like wine but they can't distinguish it from juice by taste ...
564
Title: Tavas and Pashmaks Time Limit: None seconds Memory Limit: None megabytes Problem Description: Tavas is a cheerleader in the new sports competition named "Pashmaks". This competition consists of two part: swimming and then running. People will immediately start running *R* meters after they finished swimming ...
565
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: One day Petya got a birthday present from his mom: a book called "The Legends and Myths of Graph Theory". From this book Petya learned about a hydra graph. A non-oriented graph is a hydra, if it has a structure, shown on the figu...
566
Title: Brain Network (medium) Time Limit: None seconds Memory Limit: None megabytes Problem Description: Further research on zombie thought processes yielded interesting results. As we know from the previous problem, the nervous system of a zombie consists of *n* brains and *m* brain connectors joining some pairs of...
567
Title: Coins Exhibition Time Limit: None seconds Memory Limit: None megabytes Problem Description: Arkady and Kirill visited an exhibition of rare coins. The coins were located in a row and enumerated from left to right from 1 to *k*, each coin either was laid with its obverse (front) side up, or with its reverse (b...
568
Title: A polyline Time Limit: None seconds Memory Limit: None megabytes Problem Description: Input Specification: The input contains two integers *a*,<=*b* (1<=≀<=*a*<=≀<=10,<=0<=≀<=*b*<=≀<=22Β·*a*<=-<=1) separated by a single space. Output Specification: Output two integers separated by a single space. Demo Inpu...
569
Title: Change-free Time Limit: None seconds Memory Limit: None megabytes Problem Description: Student Arseny likes to plan his life for *n* days ahead. He visits a canteen every day and he has already decided what he will order in each of the following *n* days. Prices in the canteen do not change and that means Ars...
570
Title: Game Shopping Time Limit: None seconds Memory Limit: None megabytes Problem Description: Maxim wants to buy some games at the local game shop. There are $n$ games in the shop, the $i$-th game costs $c_i$. Maxim has a wallet which can be represented as an array of integers. His wallet contains $m$ bills, the ...
571
Title: Name Quest Time Limit: None seconds Memory Limit: None megabytes Problem Description: A Martian boy is named *s* β€” he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys looking for his name everywhere. If he sees that he can obtain his name from some string by remo...
572
Title: Good Number Time Limit: None seconds Memory Limit: None megabytes Problem Description: Let's call a number *k*-good if it contains all digits not exceeding *k* (0,<=...,<=*k*). You've got a number *k* and an array *a* containing *n* numbers. Find out how many *k*-good numbers are in *a* (count each number eve...
573
Title: Help General Time Limit: None seconds Memory Limit: None megabytes Problem Description: Once upon a time in the Kingdom of Far Far Away lived Sir Lancelot, the chief Royal General. He was very proud of his men and he liked to invite the King to come and watch drill exercises which demonstrated the fighting te...
574
Title: Gluttony Time Limit: None seconds Memory Limit: None megabytes Problem 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*<==<={*x*1,<=*x*2,<=...,<=*x**k*} (1<=≀<=*x**i*<=≀<=*n*, 0<=&lt;<=*k*<=&lt;<=*n*...
575
Title: Handshakes Time Limit: None seconds Memory Limit: None megabytes Problem Description: On February, 30th *n* students came in the Center for Training Olympiad Programmers (CTOP) of the Berland State University. They came one by one, one after another. Each of them went in, and before sitting down at his desk, ...
576
Title: Misha and LCP on Tree Time Limit: None seconds Memory Limit: None megabytes Problem Description: Misha has a tree with characters written on the vertices. He can choose two vertices *s* and *t* of this tree and write down characters of vertices lying on a path from *s* to *t*. We'll say that such string corre...
577
Title: Mike and strings Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mike has *n* strings *s*1,<=*s*2,<=...,<=*s**n* each consisting of lowercase English letters. In one move he can choose a string *s**i*, erase the first character and append it to the end of the string. For example, if...
578
Title: Lecture Time Limit: None seconds Memory Limit: None megabytes Problem Description: You have a new professor of graph theory and he speaks very quickly. You come up with the following plan to keep up with his lecture and make notes. You know two languages, and the professor is giving the lecture in the first ...
579
Title: Dog Show Time Limit: None seconds Memory Limit: None megabytes Problem Description: A new dog show on TV is starting next week. On the show dogs are required to demonstrate bottomless stomach, strategic thinking and self-preservation instinct. You and your dog are invited to compete with other participants an...
580
Title: Game Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: Vasya and Petya have invented a new game. Vasya takes a stripe consisting of 1<=Γ—<=*n* square and paints the squares black and white. After that Petya can start moves β€” during a move he may choose any two neighboring squares of one co...
581
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: In the army, it isn't easy to form a group of soldiers that will be effective on the battlefield. The communication is crucial and thus no two soldiers should share a name (what would happen if they got an order that Bob is a scou...
582
Title: Correct Solution? Time Limit: 2 seconds Memory Limit: 256 megabytes Problem Description: One cold winter evening Alice and her older brother Bob was sitting at home near the fireplace and giving each other interesting problems to solve. When it was Alice's turn, she told the number *n* to Bob and said: β€”Shuf...
583
Title: Cutting Figure Time Limit: None seconds Memory Limit: None megabytes Problem Description: You've gotten an *n*<=Γ—<=*m* sheet of squared paper. Some of its squares are painted. Let's mark the set of all painted squares as *A*. Set *A* is connected. Your task is to find the minimum number of squares that we can...
584
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Sometimes Mister B has free evenings when he doesn't know what to do. Fortunately, Mister B found a new game, where the player can play against aliens. All characters in this game are lowercase English letters. There are two play...
585
Title: Road Widening Time Limit: None seconds Memory Limit: None megabytes Problem Description: Mayor of city S just hates trees and lawns. They take so much space and there could be a road on the place they occupy! The Mayor thinks that one of the main city streets could be considerably widened on account of lawn ...
586
Title: Curfew Time Limit: None seconds Memory Limit: None megabytes Problem Description: Instructors of Some Informatics School make students go to bed. The house contains *n* rooms, in each room exactly *b* students were supposed to sleep. However, at the time of curfew it happened that many students are not locat...
587
Title: Interesting Array Time Limit: None seconds Memory Limit: None megabytes Problem Description: We'll call an array of *n* non-negative integers *a*[1],<=*a*[2],<=...,<=*a*[*n*] interesting, if it meets *m* constraints. The *i*-th of the *m* constraints consists of three integers *l**i*, *r**i*, *q**i* (1<=≀<=*l...
588
Title: Coat of Anticubism Time Limit: None seconds Memory Limit: None megabytes Problem Description: As some of you know, cubism is a trend in art, where the problem of constructing volumetrical shape on a plane with a combination of three-dimensional geometric shapes comes to the fore. A famous sculptor Cicasso, ...
589
Title: Strip Time Limit: None seconds Memory Limit: None megabytes Problem Description: Alexandra has a paper strip with *n* numbers on it. Let's call them *a**i* from left to right. Now Alexandra wants to split it into some pieces (possibly 1). For each piece of strip, it must satisfy: - Each piece should contain...
590
Title: Broken Monitor Time Limit: None seconds Memory Limit: None megabytes Problem Description: Innocentius has a problem β€” his computer monitor has broken. Now some of the pixels are "dead", that is, they are always black. As consequence, Innocentius can't play the usual computer games. He is recently playing the ...
591
Title: Deciphering Time Limit: None seconds Memory Limit: None megabytes Problem Description: One day Maria Ivanovna found a Sasha's piece of paper with a message dedicated to Olya. Maria Ivanovna wants to know what is there in a message, but unfortunately the message is ciphered. Maria Ivanovna knows that her stude...
592
Title: Flag Day Time Limit: None seconds Memory Limit: None megabytes Problem Description: In Berland, there is the national holiday coming β€” the Flag Day. In the honor of this event the president of the country decided to make a big dance party and asked your agency to organize it. He has several conditions: - ov...
593
Title: Fedor and coupons Time Limit: None seconds Memory Limit: None megabytes Problem Description: All our characters have hobbies. The same is true for Fedor. He enjoys shopping in the neighboring supermarket. The goods in the supermarket have unique integer ids. Also, for every integer there is a product with i...
594
Title: Cyclical Quest Time Limit: None seconds Memory Limit: None megabytes Problem Description: Some days ago, WJMZBMR learned how to answer the query "how many times does a string *x* occur in a string *s*" quickly by preprocessing the string *s*. But now he wants to make it harder. So he wants to ask "how many c...
595
Title: Lucky Tickets Time Limit: None seconds Memory Limit: None megabytes Problem Description: Gerald has a friend, Pollard. Pollard is interested in lucky tickets (ticket is a sequence of digits). At first he thought that a ticket is lucky if between some its digits we can add arithmetic signs and brackets so that...
596
Title: Oleg and shares Time Limit: None seconds Memory Limit: None megabytes Problem Description: Oleg the bank client checks share prices every day. There are *n* share prices he is interested in. Today he observed that each second exactly one of these prices decreases by *k* rubles (note that each second exactly o...
597
Title: The Useless Toy Time Limit: None seconds Memory Limit: None megabytes Problem Description: Walking through the streets of Marshmallow City, Slastyona have spotted some merchants selling a kind of useless toy which is very popular nowadays – caramel spinner! Wanting to join the craze, she has immediately bough...
598
Title: none Time Limit: None seconds Memory Limit: None megabytes Problem Description: Polycarp and Vasiliy love simple logical games. Today they play a game with infinite chessboard and one pawn for each player. Polycarp and Vasiliy move in turns, Polycarp starts. In each turn Polycarp can move his pawn from cell (...
599