## F. Prefixes and Suffixes Codeforces Solution Kotlin Heroes: Practice 7

F. Prefixes and Suffixes Codeforces Solution Ivan wants to play a game with you. He picked some string s of length n consisting only of lowercase Latin letters. You don’t know this string. Ivan has informed you about all its improper prefixes and suffixes (i.e. prefixes and suffixes of lengths from 1 to n−1), but … Read more

## E. Good Array Codeforces Solution Kotlin Heroes: Practice 7

E. Good Array Codeforces Solution Let’s call an array good if there is an element in the array that equals to the sum of all other elements. For example, the array a=[1,3,3,7] is good because there is the element a4=7 which equals to the sum 1+3+3. You are given an array a consisting of n … Read more

## D. Teams Forming Codeforces Solution Kotlin Heroes: Practice 7

D. Teams Forming Codeforces Solution There are n students in a university. The number of students is even. The i-th student has programming skill equal to ai. The coach wants to form n2 teams. Each team should consist of exactly two students, and each student should belong to exactly one team. Two students can form … Read more

## C. Uniform String Codeforces Solution Kotlin Heroes: Practice 7

C. Uniform String Codeforces Solution You are given two integers n and k. Your task is to construct such a string s of length n that for each i from 1 to k there is at least one i-th letter of the Latin alphabet in this string (the first letter is ‘a’, the second is … Read more

## B. Frog Jumping Codeforces Solution Kotlin Heroes: Practice 7

B. Frog Jumping Codeforces Solution A frog is currently at the point 0 on a coordinate axis Ox. It jumps by the following algorithm: the first jump is a units to the right, the second jump is b units to the left, the third jump is a units to the right, the fourth jump is … Read more

## A. A+B (Trial Problem) Codeforces Solution Kotlin Heroes: Practice 7

A. A+B (Trial Problem) Codeforces Solution You are given two integers a and b. Print a+b. InputThe first line contains an integer t (1≤t≤104) — the number of test cases in the input. Then t test cases follow. Each test case is given as a line of two integers a and b (−1000≤a,b≤1000). OutputPrint t … Read more

## D. PriceFixed Codeforces Solution | Round 727

PriceFixed Solution Codeforces Round 727 Lena is the most economical girl in Moscow. So, when her dad asks her to buy some food for a trip to the country, she goes to the best store — “PriceFixed”. Here are some rules of that store: The store has an infinite number of items of every product.All … Read more

## C. Stable Groups Codeforces Solution | Round #727 (Div. 2)

Stable Groups Solution Codeforces Round 727 There are n students numerated from 1 to n. The level of the i-th student is ai. You need to split the students into stable groups. A group of students is called stable, if in the sorted array of their levels no two neighboring elements differ by more than … Read more

## E. Distinctive Roots in a Tree SOLUTION Codeforces

You are given a tree with n vertices. Each vertex i has a value ai associated with it. Let us root the tree at some vertex v. The vertex v is called a distinctive root if the following holds: in all paths that start at v and end at some other node, all the values … Read more

## D. Sum of Paths SOLUTION Codeforces

There are n cells, numbered 1,2,…,n from left to right. You have to place a robot at any cell initially. The robot must make exactly k moves. In one move, the robot must move one cell to the left or right, provided that it doesn’t move out of bounds. In other words, if the robot … Read more

error: Content is protected !!
+