text
stringlengths
424
69.5k
### Prompt Please create a solution in Cpp to the following problem: You're given the centers of three equal sides of a strictly convex tetragon. Your task is to restore the initial tetragon. Input The first input line contains one number T — amount of tests (1 ≤ T ≤ 5·104). Each of the following T lines contains n...
### Prompt In Cpp, your task is to solve the following problem: Tokitsukaze and CSL are playing a little game of stones. In the beginning, there are n piles of stones, the i-th pile of which has a_i stones. The two players take turns making moves. Tokitsukaze moves first. On each turn the player chooses a nonempty p...
### Prompt Please formulate a CPP solution to the following problem: Medicine faculty of Berland State University has just finished their admission campaign. As usual, about 80\% of applicants are girls and majority of them are going to live in the university dormitory for the next 4 (hopefully) years. The dormitory...
### Prompt Generate a cpp solution to the following problem: Snuke found a record of a tree with N vertices in ancient ruins. The findings are as follows: * The vertices of the tree were numbered 1,2,...,N, and the edges were numbered 1,2,...,N-1. * Edge i connected Vertex a_i and b_i. * The length of each edge was ...
### Prompt Construct a cpp code solution to the problem outlined: Note that the difference between easy and hard versions is that in hard version unavailable cells can become available again and in easy version can't. You can make hacks only if all versions are solved. Ildar and Ivan are tired of chess, but they rea...
### Prompt Your challenge is to write a CPP solution to the following problem: Piet is one of the most known visual esoteric programming languages. The programs in Piet are constructed from colorful blocks of pixels and interpreted using pretty complicated rules. In this problem we will use a subset of Piet language ...
### Prompt Create a solution in cpp for the following problem: You are given an unweighted tree with n vertices. Then n - 1 following operations are applied to the tree. A single operation consists of the following steps: 1. choose two leaves; 2. add the length of the simple path between them to the answer; ...
### Prompt Please formulate a CPP solution to the following problem: The ICPC committee would like to have its meeting as soon as possible to address every little issue of the next contest. However, members of the committee are so busy maniacally developing (possibly useless) programs that it is very difficult to arr...
### Prompt Please provide a CPP coded solution to the problem described below: Breaking Good is a new video game which a lot of gamers want to have. There is a certain level in the game that is really difficult even for experienced gamers. Walter William, the main character of the game, wants to join a gang called L...
### Prompt Your challenge is to write a CPP solution to the following problem: Petya loves lucky numbers. We all know that lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya got an array ...
### Prompt Your challenge is to write a cpp solution to the following problem: You are a warrior fighting against the machine god Thor. Thor challenge you to solve the following problem: There are n conveyors arranged in a line numbered with integers from 1 to n from left to right. Each conveyor has a symbol "<" or...
### Prompt Your challenge is to write a CPP solution to the following problem: Berland has a long and glorious history. To increase awareness about it among younger citizens, King of Berland decided to compose an anthem. Though there are lots and lots of victories in history of Berland, there is the one that stand o...
### Prompt Your task is to create a CPP solution to the following problem: 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 + 1, ..., ri by value di. Greg wrote do...
### Prompt Construct a CPP code solution to the problem outlined: Butler Ostin wants to show Arkady that rows of odd number of fountains are beautiful, while rows of even number of fountains are not. The butler wants to show Arkady n gardens. Each garden is a row of m cells, the i-th garden has one fountain in each ...
### Prompt Your task is to create a CPP solution to the following problem: C --Misawa's rooted tree Problem Statement You noticed that your best friend Misawa's birthday was near, and decided to give him a rooted binary tree as a gift. Here, the rooted binary tree has the following graph structure. (Figure 1) * Ea...
### Prompt In CPP, your task is to solve the following problem: There is a blackboard on which all integers from -10^{18} through 10^{18} are written, each of them appearing once. Takahashi will repeat the following sequence of operations any number of times he likes, possibly zero: * Choose an integer between 1 and...
### Prompt Develop a solution in Cpp to the problem described below: Now Fox Ciel becomes a commander of Tree Land. Tree Land, like its name said, has n cities connected by n - 1 undirected roads, and for any two cities there always exists a path between them. Fox Ciel needs to assign an officer to each city. Each o...
### Prompt Your challenge is to write a cpp solution to the following problem: Consider a permutation p_1, p_2, ... p_n of integers from 1 to n. We call a sub-segment p_l, p_{l+1}, ..., p_{r-1}, p_{r} of the permutation an interval if it is a reordering of some set of consecutive integers. For example, the permutatio...
### Prompt Please provide a cpp coded solution to the problem described below: Assume that you have k one-dimensional segments s_1, s_2, ... s_k (each segment is denoted by two integers — its endpoints). Then you can build the following graph on these segments. The graph consists of k vertexes, and there is an edge b...
### Prompt In CPP, your task is to solve the following problem: In a building where Polycarp lives there are equal number of flats on each floor. Unfortunately, Polycarp don't remember how many flats are on each floor, but he remembers that the flats are numbered from 1 from lower to upper floors. That is, the first ...
### Prompt Construct a cpp code solution to the problem outlined: Sereja has painted n distinct points on the plane. The coordinates of each point are integers. Now he is wondering: how many squares are there with sides parallel to the coordinate axes and with points painted in all its four vertexes? Help him, calcul...
### Prompt Construct a CPP code solution to the problem outlined: The only difference between easy and hard versions are constraints on n and k. You are messaging in one of the popular social networks via your smartphone. Your smartphone can show at most k most recent conversations with your friends. Initially, the ...
### Prompt In CPP, your task is to solve the following problem: We have N points numbered 1 to N arranged in a line in this order. Takahashi decides to make an undirected graph, using these points as the vertices. In the beginning, the graph has no edge. Takahashi will do M operations to add edges in this graph. The...
### Prompt Please formulate a Cpp solution to the following problem: Bob recently read about bitwise operations used in computers: AND, OR and XOR. He have studied their properties and invented a new game. Initially, Bob chooses integer m, bit depth of the game, which means that all numbers in the game will consist ...
### Prompt In Cpp, your task is to solve the following problem: Write a program which reads an integer n and draws a Koch curve based on recursive calles of depth n. The Koch curve is well known as a kind of fractals. You can draw a Koch curve in the following algorithm: * Divide a given segment (p1, p2) into thre...
### Prompt In Cpp, your task is to solve the following problem: Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string s = s_1 s_2 ... s_{n} of length n where each letter is either R, S or P. While initializing, the bot is choosing ...
### Prompt Your task is to create a Cpp solution to the following problem: Tree is a connected acyclic graph. Suppose you are given a tree consisting of n vertices. The vertex of this tree is called centroid if the size of each connected component that appears if this vertex is removed from the tree doesn't exceed <i...
### Prompt Your challenge is to write a Cpp solution to the following problem: Leha like all kinds of strange things. Recently he liked the function F(n, k). Consider all possible k-element subsets of the set [1, 2, ..., n]. For subset find minimal element in it. F(n, k) — mathematical expectation of the minimal elem...
### Prompt Generate a cpp solution to the following problem: Allen and Bessie are playing a simple number game. They both know a function f: \{0, 1\}^n → R, i. e. the function takes n binary arguments and returns a real value. At the start of the game, the variables x_1, x_2, ..., x_n are all set to -1. Each round, w...
### Prompt Please provide a cpp coded solution to the problem described below: A student's life is fraught with complications. Some Berland University students know this only too well. Having studied for two years, they contracted strong antipathy towards the chairperson of some department. Indeed, the person in ques...
### Prompt Please create a solution in CPP to the following problem: There is a square grid of size n × n. Some cells are colored in black, all others are colored in white. In one operation you can select some rectangle and color all its cells in white. It costs max(h, w) to color a rectangle of size h × w. You are t...
### Prompt Develop a solution in cpp to the problem described below: Alice and Bob begin their day with a quick game. They first choose a starting number X0 ≥ 3 and try to reach one million by the process described below. Alice goes first and then they take alternating turns. In the i-th turn, the player whose turn...
### Prompt Generate a Cpp solution to the following problem: Alice and Bob are playing a game with n piles of stones. It is guaranteed that n is an even number. The i-th pile has a_i stones. Alice and Bob will play a game alternating turns with Alice going first. On a player's turn, they must choose exactly n/2 non...
### Prompt Create a solution in cpp for the following problem: JAG mock qualifying practice session The ACM-ICPC OB / OG Association (Japanese Alumni Group; JAG) has N questions in stock of questions to be asked in the mock contest, and each question is numbered with an integer from 1 to N. Difficulty evaluation and...
### Prompt Please create a solution in Cpp to the following problem: Translator's note: in Russia's most widespread grading system, there are four grades: 5, 4, 3, 2, the higher the better, roughly corresponding to A, B, C and F respectively in American grading system. The term is coming to an end and students start...
### Prompt In cpp, your task is to solve the following problem: Sergey is testing a next-generation processor. Instead of bytes the processor works with memory cells consisting of n bits. These bits are numbered from 1 to n. An integer is stored in the cell in the following way: the least significant bit is stored in...
### Prompt Generate a cpp solution to the following problem: A team of students from the city S is sent to the All-Berland Olympiad in Informatics. Traditionally, they go on the train. All students have bought tickets in one carriage, consisting of n compartments (each compartment has exactly four people). We know th...
### Prompt Please create a solution in Cpp to the following problem: n children are standing in a circle and playing the counting-out game. Children are numbered clockwise from 1 to n. In the beginning, the first child is considered the leader. The game is played in k steps. In the i-th step the leader counts out ai ...
### Prompt Create a solution in Cpp for the following problem: Arcady is a copywriter. His today's task is to type up an already well-designed story using his favorite text editor. Arcady types words, punctuation signs and spaces one after another. Each letter and each sign (including line feed) requires one keyboar...
### Prompt Please provide a cpp coded solution to the problem described below: There are N pinholes on the xy-plane. The i-th pinhole is located at (x_i,y_i). We will denote the Manhattan distance between the i-th and j-th pinholes as d(i,j)(=|x_i-x_j|+|y_i-y_j|). You have a peculiar pair of compasses, called Manha...
### Prompt Develop a solution in CPP to the problem described below: Niwango-kun, an employee of Dwango Co., Ltd., likes Niconico TV-chan, so he collected a lot of soft toys of her and spread them on the floor. Niwango-kun has N black rare soft toys of Niconico TV-chan and they are spread together with ordinary ones...
### Prompt Your task is to create a cpp solution to the following problem: This is the easy version of the problem. The difference between the versions is in the constraints on the array elements. You can make hacks only if all versions of the problem are solved. You are given an array [a_1, a_2, ..., a_n]. Your g...
### Prompt Construct a Cpp code solution to the problem outlined: In BerSoft n programmers work, the programmer i is characterized by a skill r_i. A programmer a can be a mentor of a programmer b if and only if the skill of the programmer a is strictly greater than the skill of the programmer b (r_a > r_b) and progr...
### Prompt Develop a solution in Cpp to the problem described below: Vitya has just started learning Berlanese language. It is known that Berlanese uses the Latin alphabet. Vowel letters are "a", "o", "u", "i", and "e". Other letters are consonant. In Berlanese, there has to be a vowel after every consonant, but the...
### Prompt Create a solution in Cpp for the following problem: Igor the analyst has adopted n little bunnies. As we all know, bunnies love carrots. Thus, Igor has bought a carrot to be shared between his bunnies. Igor wants to treat all the bunnies equally, and thus he wants to cut the carrot into n pieces of equal a...
### Prompt Your task is to create a Cpp solution to the following problem: Now that you have proposed a fake post for the HC2 Facebook page, Heidi wants to measure the quality of the post before actually posting it. She recently came across a (possibly fake) article about the impact of fractal structure on multimedia...
### Prompt Create a solution in CPP for the following problem: You are given a sequence of positive integers x1, x2, ..., xn and two non-negative integers a and b. Your task is to transform a into b. To do that, you can perform the following moves: * subtract 1 from the current a; * subtract a mod xi (1 ≤ i ≤ n...
### Prompt In cpp, your task is to solve the following problem: Levian works as an accountant in a large company. Levian knows how much the company has earned in each of the n consecutive months — in the i-th month the company had income equal to a_i (positive income means profit, negative income means loss, zero inc...
### Prompt Create a solution in CPP for the following problem: Let's denote a function f(x) in such a way: we add 1 to x, then, while there is at least one trailing zero in the resulting number, we remove that zero. For example, * f(599) = 6: 599 + 1 = 600 → 60 → 6; * f(7) = 8: 7 + 1 = 8; * f(9) = 1: 9 + 1 ...
### Prompt Develop a solution in cpp to the problem described below: You are given a positive decimal number x. Your task is to convert it to the "simple exponential notation". Let x = a·10b, where 1 ≤ a < 10, then in general case the "simple exponential notation" looks like "aEb". If b equals to zero, the part "Eb...
### Prompt Please formulate a Cpp solution to the following problem: You have matrix a of size n × n. Let's number the rows of the matrix from 1 to n from top to bottom, let's number the columns from 1 to n from left to right. Let's use aij to represent the element on the intersection of the i-th row and the j-th col...
### Prompt Your task is to create a Cpp solution to the following problem: You are given a range of positive integers from l to r. Find such a pair of integers (x, y) that l ≤ x, y ≤ r, x ≠ y and x divides y. If there are multiple answers, print any of them. You are also asked to answer T independent queries. Inp...
### Prompt Your challenge is to write a Cpp solution to the following problem: Long time ago Alex created an interesting problem about parallelogram. The input data for this problem contained four integer points on the Cartesian plane, that defined the set of vertices of some non-degenerate (positive area) parallelog...
### Prompt Please create a solution in Cpp to the following problem: There are N islands floating in Ringo Sea, and M travel agents operate ships between these islands. For convenience, we will call these islands Island 1, 2, …, N, and call these agents Agent 1, 2, …, M. The sea currents in Ringo Sea change signific...
### Prompt Your task is to create a CPP solution to the following problem: Alice and Bob play 5-in-a-row game. They have a playing field of size 10 × 10. In turns they put either crosses or noughts, one at a time. Alice puts crosses and Bob puts noughts. In current match they have made some turns and now it's Alice'...
### Prompt Your task is to create a CPP solution to the following problem: The end of the school year is near and Ms. Manana, the teacher, will soon have to say goodbye to a yet another class. She decided to prepare a goodbye present for her n students and give each of them a jigsaw puzzle (which, as wikipedia states...
### Prompt Your challenge is to write a Cpp solution to the following problem: Bajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands in another snow drift. He has noticed that in this way it...
### Prompt Please provide a cpp coded solution to the problem described below: DZY loves collecting special strings which only contain lowercase letters. For each lowercase letter c DZY knows its value wc. For each special string s = s1s2... s|s| (|s| is the length of the string) he represents its value with a functi...
### Prompt Develop a solution in CPP to the problem described below: In this problem, a n × m rectangular matrix a is called increasing if, for each row of i, when go from left to right, the values strictly increase (that is, a_{i,1}<a_{i,2}<...<a_{i,m}) and for each column j, when go from top to bottom, the values s...
### Prompt Construct a Cpp code solution to the problem outlined: Pavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common side. Pavel drew a grid maze with all empty cells forming ...
### Prompt Develop a solution in Cpp to the problem described below: <image> To monitor cryptocurrency exchange rates trader William invented a wonderful device consisting of n lights arranged in a row. The device functions in the following way: Initially, all lights on William's device are turned off. At the begin...
### Prompt Please create a solution in cpp to the following problem: There is a very secret base in Potatoland where potato mash is made according to a special recipe. The neighbours from Porridgia decided to seize this recipe and to sell it to Pilauland. For this mission they have been preparing special agent Pearlo...
### Prompt Please formulate a Cpp solution to the following problem: Recent improvements in information and communication technology have made it possible to provide municipal service to a wider area more quickly and with less costs. Stimulated by this, and probably for saving their not sufficient funds, mayors of ma...
### Prompt Please create a solution in Cpp to the following problem: You are playing a new famous fighting game: Kortal Mombat XII. You have to perform a brutality on your opponent's character. You are playing the game on the new generation console so your gamepad have 26 buttons. Each button has a single lowercase ...
### Prompt Please provide a cpp coded solution to the problem described below: Kevin Sun wants to move his precious collection of n cowbells from Naperthrill to Exeter, where there is actually grass instead of corn. Before moving, he must pack his cowbells into k boxes of a fixed size. In order to keep his collection...
### Prompt Create a solution in Cpp for the following problem: Write a program which reads a $n \times m$ matrix $A$ and a $m \times l$ matrix $B$, and prints their product, a $n \times l$ matrix $C$. An element of matrix $C$ is obtained by the following formula: \\[ c_{ij} = \sum_{k=1}^m a_{ik}b_{kj} \\] where $a_...
### Prompt Please formulate a CPP solution to the following problem: Your task is to shuffle a deck of n cards, each of which is marked by a alphabetical letter. A single shuffle action takes out h cards from the bottom of the deck and moves them to the top of the deck. The deck of cards is represented by a string ...
### Prompt Construct a cpp code solution to the problem outlined: Snuke has an integer sequence A of length N. He will make three cuts in A and divide it into four (non-empty) contiguous subsequences B, C, D and E. The positions of the cuts can be freely chosen. Let P,Q,R,S be the sums of the elements in B,C,D,E, r...
### Prompt Please provide a cpp coded solution to the problem described below: A rabbit who came to the fair found that the prize for a game at a store was a carrot cake. The rules for this game are as follows. There is a grid-like field of vertical h squares x horizontal w squares, and each block has at most one bl...
### Prompt Your task is to create a Cpp solution to the following problem: Dreamoon likes coloring cells very much. There is a row of n cells. Initially, all cells are empty (don't contain any color). Cells are numbered from 1 to n. You are given an integer m and m integers l_1, l_2, …, l_m (1 ≤ l_i ≤ n) Dreamoon ...
### Prompt Your task is to create a Cpp solution to the following problem: Denis was very sad after Nastya rejected him. So he decided to walk through the gateways to have some fun. And luck smiled at him! When he entered the first courtyard, he met a strange man who was selling something. Denis bought a mysterious...
### Prompt Develop a solution in cpp to the problem described below: Given is a string S, where each character is `0`, `1`, or `?`. Consider making a string S' by replacing each occurrence of `?` with `0` or `1` (we can choose the character for each `?` independently). Let us define the unbalancedness of S' as follo...
### Prompt In Cpp, your task is to solve the following problem: problem One day in the cold winter, JOI Taro decided to break the thin ice in the plaza and play. The square is rectangular and is divided into m sections in the east-west direction and n sections in the north-south direction, that is, m × n. In additio...
### Prompt Your challenge is to write a cpp solution to the following problem: 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 several increasing sequences which he then plans to merge ...
### Prompt Your challenge is to write a cpp solution to the following problem: A pitch-black room When I woke up, Mr. A was in a pitch-black room. Apparently, Mr. A got lost in a dungeon consisting of N rooms. You couldn't know which room A got lost in, but fortunately he got a map of the dungeon. Let's show A the w...
### Prompt Please create a solution in CPP to the following problem: There are n balls. They are arranged in a row. Each ball has a color (for convenience an integer) and an integer value. The color of the i-th ball is ci and the value of the i-th ball is vi. Squirrel Liss chooses some balls and makes a new sequence...
### Prompt Your task is to create a cpp solution to the following problem: One day Misha and Andrew were playing a very simple game. First, each player chooses an integer in the range from 1 to n. Let's assume that Misha chose number m, and Andrew chose number a. Then, by using a random generator they choose a rando...
### Prompt Please formulate a cpp solution to the following problem: <image> A directed acyclic graph (DAG) can be used to represent the ordering of tasks. Tasks are represented by vertices and constraints where one task can begin before another, are represented by edges. For example, in the above example, you can ...
### Prompt Your challenge is to write a cpp solution to the following problem: Lena is a programmer. She got a task to solve at work. There is an empty set of pairs of integers and n queries to process. Each query is one of three types: 1. Add a pair (a, b) to the set. 2. Remove a pair added in the query numbe...
### Prompt Construct a Cpp code solution to the problem outlined: Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (may be negative, i. e. points were subtracted). Initially the participant had some score, and each the marks were one by one added to...
### Prompt Please create a solution in Cpp to the following problem: The Smart Beaver from ABBYY invented a new message encryption method and now wants to check its performance. Checking it manually is long and tiresome, so he decided to ask the ABBYY Cup contestants for help. A message is a sequence of n integers a...
### Prompt Please provide a cpp coded solution to the problem described below: The Bubble Cup hypothesis stood unsolved for 130 years. Who ever proves the hypothesis will be regarded as one of the greatest mathematicians of our time! A famous mathematician Jerry Mao managed to reduce the hypothesis to this problem: ...
### Prompt Please provide a cpp coded solution to the problem described below: It's a very unfortunate day for Volodya today. He got bad mark in algebra and was therefore forced to do some work in the kitchen, namely to cook borscht (traditional Russian soup). This should also improve his algebra skills. According t...
### Prompt Construct a cpp code solution to the problem outlined: The Ohgas are a prestigious family based on Hachioji. The head of the family, Mr. Nemochi Ohga, a famous wealthy man, wishes to increase his fortune by depositing his money to an operation company. You are asked to help Mr. Ohga maximize his profit by ...
### Prompt Please formulate a cpp solution to the following problem: ZS the Coder and Chris the Baboon arrived at the entrance of Udayland. There is a n × n magic grid on the entrance which is filled with integers. Chris noticed that exactly one of the cells in the grid is empty, and to enter Udayland, they need to f...
### Prompt Please create a solution in CPP to the following problem: The R1 company has recently bought a high rise building in the centre of Moscow for its main office. It's time to decorate the new office, and the first thing to do is to write the company's slogan above the main entrance to the building. The sloga...
### Prompt Construct a cpp code solution to the problem outlined: Write a program which manipulates a sequence $A$ = {$a_0, a_1, ..., a_{n-1}$} with the following operations: * $update(s, t, x)$: change $a_s, a_{s+1}, ..., a_t$ to $x$. * $getSum(s, t)$: print the sum of $a_s, a_{s+1}, ..., a_t$. Note that the ini...
### Prompt Your challenge is to write a cpp solution to the following problem: In Python, code blocks don't have explicit begin/end or curly braces to mark beginning and end of the block. Instead, code blocks are defined by indentation. We will consider an extremely simplified subset of Python with only two types of...
### Prompt Your task is to create a Cpp solution to the following problem: After a long journey, the super-space-time immigrant ship carrying you finally discovered a planet that seems to be habitable. The planet, named JOI, is a harsh planet with three types of terrain, "Jungle," "Ocean," and "Ice," as the name impl...
### Prompt Create a solution in Cpp for the following problem: Eric is the teacher of graph theory class. Today, Eric teaches independent set and edge-induced subgraph. Given a graph G=(V,E), an independent set is a subset of vertices V' ⊂ V such that for every pair u,v ∈ V', (u,v) not ∈ E (i.e. no edge in E connect...
### Prompt Construct a CPP code solution to the problem outlined: [SIHanatsuka - EMber](https://soundcloud.com/hanatsuka/sihanatsuka-ember) [SIHanatsuka - ATONEMENT](https://soundcloud.com/hanatsuka/sihanatsuka-atonement) Back in time, the seven-year-old Nora used to play lots of games with her creation ROBO_Head-0...
### Prompt Your task is to create a CPP solution to the following problem: Mr. Bill is shopping at the store. There are some coins in his wallet (10-yen coins, 50-yen coins, 100-yen coins, 500-yen coins), but he is now trying to consume as much of this coin as possible. In other words, by paying for the goods with an...
### Prompt Your challenge is to write a CPP solution to the following problem: According to Berland laws it is only allowed to sell alcohol to people not younger than 18 years. Vasya's job is to monitor the law's enforcement. Tonight he entered a bar and saw n people sitting there. For every one of them Vasya happene...
### Prompt In CPP, your task is to solve the following problem: On his free time, Chouti likes doing some housework. He has got one new task, paint some bricks in the yard. There are n bricks lined in a row on the ground. Chouti has got m paint buckets of different colors at hand, so he painted each brick in one of ...
### Prompt Please create a solution in Cpp to the following problem: Gildong is experimenting with an interesting machine Graph Traveler. In Graph Traveler, there is a directed graph consisting of n vertices numbered from 1 to n. The i-th vertex has m_i outgoing edges that are labeled as e_i[0], e_i[1], …, e_i[m_i-1]...
### Prompt Your challenge is to write a cpp solution to the following problem: Let's assume that set S consists of m distinct intervals [l1, r1], [l2, r2], ..., [lm, rm] (1 ≤ li ≤ ri ≤ n; li, ri are integers). Let's assume that f(S) is the maximum number of intervals that you can choose from the set S, such that eve...
### Prompt Your task is to create a cpp solution to the following problem: For given n points in metric space, find the distance of the closest points. Constraints * 2 ≤ n ≤ 100,000 * -100 ≤ x, y ≤ 100 Input n x0 y0 x1 y1 : xn-1 yn-1 The first integer n is the number of points. In the following n lines, the c...
### Prompt Your challenge is to write a Cpp solution to the following problem: Levko loves array a1, a2, ... , an, consisting of integers, very much. That is why Levko is playing with array a, performing all sorts of operations with it. Each operation Levko performs is of one of two types: 1. Increase all elements...
### Prompt Please formulate a Cpp solution to the following problem: Being tired of participating in too many Codeforces rounds, Gildong decided to take some rest in a park. He sat down on a bench, and soon he found two rabbits hopping around. One of the rabbits was taller than the other. He noticed that the two rab...
### Prompt Create a solution in Cpp for the following problem: The only difference between easy and hard versions is constraints. You are given n segments on the coordinate axis OX. Segments can intersect, lie inside each other and even coincide. The i-th segment is [l_i; r_i] (l_i ≤ r_i) and it covers all integer p...