Problem ID
stringlengths
2
6
Problem Description
stringlengths
0
7.52k
Rating
float64
800
3.5k
math
bool
2 classes
greedy
bool
2 classes
implementation
bool
2 classes
dp
bool
2 classes
data structures
bool
2 classes
constructive algorithms
bool
2 classes
brute force
bool
2 classes
binary search
bool
2 classes
sortings
bool
2 classes
graphs
bool
2 classes
__index_level_0__
int64
3
9.98k
1348F
Problem - 1348F - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
2,600
false
true
false
false
true
false
false
false
false
true
3,965
245C
Two pirates Polycarpus and Vasily play a very interesting game. They have _n_ chests with coins, the chests are numbered with integers from 1 to _n_. Chest number _i_ has _a__i_ coins. Polycarpus and Vasily move in turns. Polycarpus moves first. During a move a player is allowed to choose a positive integer _x_ (2·_x_u...
1,700
false
true
false
false
false
false
false
false
false
false
8,854
350D
Emperor Palpatine loves owls very much. The emperor has some blueprints with the new Death Star, the blueprints contain _n_ distinct segments and _m_ distinct circles. We will consider the segments indexed from 1 to _n_ in some way and the circles — indexed from 1 to _m_ in some way. Palpatine defines an owl as a set o...
2,400
false
false
false
false
true
false
false
true
true
false
8,432
1920E
Patrick calls a substring$$$^dagger$$$ of a binary string$$$^ddagger$$$ good if this substring contains exactly one 1. Help Patrick count the number of binary strings $$$s$$$ such that $$$s$$$ contains exactly $$$n$$$ good substrings and has no good substring of length strictly greater than $$$k$$$. Note that substring...
2,100
true
false
false
true
false
false
false
false
false
false
768
1486F
You are given a tree consisting of $$$n$$$ vertices, and $$$m$$$ simple vertex paths. Your task is to find how many pairs of those paths intersect at exactly one vertex. More formally you have to find the number of pairs $$$(i, j)$$$ $$$(1 leq i < j leq m)$$$ such that $$$path_i$$$ and $$$path_j$$$ have exactly one ver...
2,600
false
false
false
true
true
false
false
false
false
false
3,247
178F2
The Smart Beaver from ABBYY has a long history of cooperating with the "Institute of Cytology and Genetics". Recently, the Institute staff challenged the Beaver with a new problem. The problem is as follows. There is a collection of _n_ proteins (not necessarily distinct). Each protein is a string consisting of lowerca...
2,200
false
false
false
true
false
false
false
false
true
false
9,124
1013A
There is a beautiful garden of stones in Innopolis. Its most beautiful place is the $$$n$$$ piles with stones numbered from $$$1$$$ to $$$n$$$. EJOI participants have visited this place twice. When they first visited it, the number of stones in piles was $$$x_1, x_2, ldots, x_n$$$, correspondingly. One of the participa...
800
true
false
false
false
false
false
false
false
false
false
5,621
375B
Problem - 375B - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,600
false
false
true
true
true
false
false
false
true
false
8,330
938B
You and your friend are participating in a TV show "Run For Your Prize". At the start of the show _n_ prizes are located on a straight line. _i_-th prize is located at position _a__i_. Positions of all prizes are distinct. You start at position 1, your friend — at position 106 (and there is no prize in any of these two...
1,100
false
true
false
false
false
false
true
false
false
false
5,950
2031E
With just a few hours left until Penchick and Chloe leave for Singapore, they could hardly wait to see the towering trees at the Singapore Botanic Gardens! Attempting to contain their excitement, Penchick crafted a rooted tree to keep Chloe and himself busy. Penchick has a rooted tree$$$^{ ext{∗}}$$$ consisting of $$$n...
2,100
true
true
true
true
true
false
false
false
true
false
76
804E
Problem - 804E - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
3,100
false
false
false
false
false
true
false
false
false
false
6,541
1184A3
Now Heidi is ready to crack Madame Kovarian's hashing function. Madame Kovarian has a very strict set of rules for name changes. Two names can be interchanged only if using the following hashing function on them results in a collision. However, the hashing function is parametrized, so one can always find a set of param...
3,100
true
false
false
false
false
false
false
false
false
false
4,792
846B
Polycarp takes part in a math show. He is given _n_ tasks, each consists of _k_ subtasks, numbered 1 through _k_. It takes him _t__j_ minutes to solve the _j_-th subtask of any task. Thus, time required to solve a subtask depends only on its index, but not on the task itself. Polycarp can solve subtasks in any order. B...
1,800
false
true
false
false
false
false
true
false
false
false
6,376
1096A
Problem - 1096A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
800
true
true
true
false
false
false
false
false
false
false
5,231
1251E2
The only difference between easy and hard versions is constraints. Now elections are held in Berland and you want to win them. More precisely, you want everyone to vote for you. There are $$$n$$$ voters, and two ways to convince each of them to vote for you. The first way to convince the $$$i$$$-th voter is to pay him ...
2,400
false
true
false
false
true
false
false
true
false
false
4,436
1036B
Mikhail walks on a Cartesian plane. He starts at the point $$$(0, 0)$$$, and in one move he can go to any of eight adjacent points. For example, if Mikhail is currently at the point $$$(0, 0)$$$, he can go to any of the following points in one move: $$$(1, 0)$$$; $$$(1, 1)$$$; $$$(0, 1)$$$; $$$(-1, 1)$$$; $$$(-1, ...
1,600
true
false
false
false
false
false
false
false
false
false
5,522
1837C
You are given a string $$$s$$$ consisting of the characters 0, 1 and/or ?. Let's call it a pattern. Let's say that the binary string (a string where each character is either 0 or 1) matches the pattern if you can replace each character ? with 0 or 1 (for each character, the choice is independent) so that the strings be...
1,000
false
true
false
false
false
true
false
false
false
false
1,268
710E
Problem - 710E - Codeforces =============== xa0 — the number of letters 'a' in the input file and the parameters from the problem statement. Output Print the only integer _t_ — the minimum amount of time needed to generate the input file. Examples Input 8 1 1 Output 4 Input 8 1 10 Output 8
2,000
false
false
false
true
false
false
false
false
false
false
6,978
1575E
There is a city park represented as a tree with $$$n$$$ attractions as its vertices and $$$n - 1$$$ rails as its edges. The $$$i$$$-th attraction has happiness value $$$a_i$$$. Each rail has a color. It is either black if $$$t_i = 0$$$, or white if $$$t_i = 1$$$. Black trains only operate on a black rail track, and whi...
2,600
false
false
false
false
true
false
false
false
false
false
2,764
1846G
A new virus called "CodeVid-23" has spread among programmers. Rudolf, being a programmer, was not able to avoid it. There are $$$n$$$ symptoms numbered from $$$1$$$ to $$$n$$$ that can appear when infected. Initially, Rudolf has some of them. He went to the pharmacy and bought $$$m$$$ medicines. For each medicine, the ...
1,900
false
true
false
true
false
false
false
false
false
true
1,201
1827C
A substring is a continuous and non-empty segment of letters from a given string, without any reorders. An even palindrome is a string that reads the same backward as forward and has an even length. For example, strings "zz", "abba", "abccba" are even palindromes, but strings "codeforces", "reality", "aba", "c" are not...
2,600
false
false
false
true
true
false
true
true
false
false
1,320
613E
Oleg Petrov loves crossword puzzles and every Thursday he buys his favorite magazine with crosswords and other word puzzles. In the last magazine Oleg found a curious puzzle, and the magazine promised a valuable prize for it's solution. We give a formal description of the problem below. The puzzle field consists of two...
3,200
false
false
false
true
false
false
false
false
false
false
7,383
1369D
# TediousLee Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 256 megabytes Lee tried so hard to make a good div.2 D problem to balance his recent contest, but it still doesn’t feel good at all. Lee invented it so tediously slow that he managed to develop a phobia about di...
1,900
true
true
false
true
false
false
false
false
false
true
3,824
1624D
You have a string $$$s$$$ consisting of lowercase Latin alphabet letters. You can color some letters in colors from $$$1$$$ to $$$k$$$. It is not necessary to paint all the letters. But for each color, there must be a letter painted in that color. Then you can swap any two symbols painted in the same color as many time...
1,400
false
true
false
false
false
false
false
true
true
false
2,497
424A
Problem - 424A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
900
false
false
true
false
false
false
false
false
false
false
8,143
1422A
Yura is tasked to build a closed fence in shape of an arbitrary non-degenerate simple quadrilateral. He's already got three straight fence segments with known lengths $$$a$$$, $$$b$$$, and $$$c$$$. Now he needs to find out some possible integer length $$$d$$$ of the fourth straight fence segment so that he can build th...
800
true
false
false
false
false
false
false
false
false
false
3,569
1037C
You are given two binary strings $$$a$$$ and $$$b$$$ of the same length. You can perform the following two operations on the string $$$a$$$: Swap any two bits at indices $$$i$$$ and $$$j$$$ respectively ($$$1 le i, j le n$$$), the cost of this operation is $$$i - j$$$, that is, the absolute difference between $$$i$$$ ...
1,300
false
true
false
true
false
false
false
false
false
false
5,514
659C
In Berland recently a new collection of toys went on sale. This collection consists of 109 types of toys, numbered with integers from 1 to 109. A toy from the new collection of the _i_-th type costs _i_ bourles. Tania has managed to collect _n_ different types of toys _a_1,u2009_a_2,u2009...,u2009_a__n_ from the new co...
1,200
false
true
true
false
false
false
false
false
false
false
7,187
1280C
Welcome! Everything is fine. You have arrived in The Medium Place, the place between The Good Place and The Bad Place. You are assigned a task that will either make people happier or torture them for eternity. You have a list of $$$k$$$ pairs of people who have arrived in a new inhabited neighborhood. You need to assig...
2,000
false
true
false
false
false
false
false
false
false
true
4,292
1770B
Reve has two integers $$$n$$$ and $$$k$$$. Let $$$p$$$ be a permutation$$$^dagger$$$ of length $$$n$$$. Let $$$c$$$ be an array of length $$$n - k + 1$$$ such that $$$$$$c_i = max(p_i, dots, p_{i+k-1}) + min(p_i, dots, p_{i+k-1}).$$$$$$ Let the cost of the permutation $$$p$$$ be the maximum element of $$$c$$$. Koxia wa...
1,000
false
false
false
false
false
true
false
false
false
false
1,676
1304B
Returning back to problem solving, Gildong is now studying about palindromes. He learned that a palindrome is a string that is the same as its reverse. For example, strings "pop", "noon", "x", and "kkkkkk" are palindromes, while strings "moon", "tv", and "abab" are not. An empty string is also a palindrome. Gildong lov...
1,100
false
true
true
false
false
true
true
false
false
false
4,170
1345A
You are given a special jigsaw puzzle consisting of $$$ncdot m$$$ identical pieces. Every piece has three tabs and one blank, as pictured below. The jigsaw puzzle is considered solved if the following conditions hold: 1. The pieces are arranged into a grid with $$$n$$$ rows and $$$m$$$ columns. 2. For any two pieces th...
800
true
false
false
false
false
false
false
false
false
false
3,981
1202A
You are given two binary strings $$$x$$$ and $$$y$$$, which are binary representations of some two integers (let's denote these integers as $$$f(x)$$$ and $$$f(y)$$$). You can choose any integer $$$k ge 0$$$, calculate the expression $$$s_k = f(x) + f(y) cdot 2^k$$$ and write the binary representation of $$$s_k$$$ in r...
1,100
false
true
false
false
false
false
false
false
false
false
4,689
831A
Problem - 831A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,000
false
false
true
false
false
false
false
false
false
false
6,442
1807C
You are given a string $$$s$$$ consisting of lowercase Latin characters. In an operation, you can take a character and replace all occurrences of this character with $$$ exttt{0}$$$ or replace all occurrences of this character with $$$ exttt{1}$$$. Is it possible to perform some number of moves so that the resulting st...
800
false
true
true
false
false
false
false
false
false
false
1,433
4C
A new e-mail service "Berlandesk" is going to be opened in Berland in the near future. The site administration wants to launch their project as soon as possible, that's why they ask you to help. You're suggested to implement the prototype of site registration system. The system should work on the following principle. E...
1,300
false
false
true
false
true
false
false
false
false
false
9,972
161D
Problem - 161D - Codeforces =============== xa0 of the shortest path between these vertices. You are given a tree with _n_ vertices and a positive number _k_. Find the number of distinct pairs of the vertices which have a distance of exactly _k_ between them. Note that pairs (_v_, _u_) and (_u_, _v_) are ...
1,800
false
false
false
true
false
false
false
false
false
false
9,227
1972A
Problem - 1972A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
800
false
true
false
false
false
false
true
false
false
false
457
643A
Bear Limak has _n_ colored balls, arranged in one long row. Balls are numbered 1 through _n_, from left to right. There are _n_ possible colors, also numbered 1 through _n_. The _i_-th ball has color _t__i_. For a fixed interval (set of consecutive elements) of balls we can define a dominant color. It's a color occurri...
1,500
false
false
true
false
false
false
false
false
false
false
7,244
1850G
A compass points directly toward the morning star. It can only point in one of eight directions: the four cardinal directions (N, S, E, W) or some combination (NW, NE, SW, SE). Otherwise, it will break. The directions the compass can point. There are $$$n$$$ distinct points with integer coordinates on a plane. How man...
1,500
true
false
true
false
true
false
false
false
true
false
1,176
1567B
Alice gave Bob two integers $$$a$$$ and $$$b$$$ ($$$a > 0$$$ and $$$b ge 0$$$). Being a curious boy, Bob wrote down an array of non-negative integers with $$$operatorname{MEX}$$$ value of all elements equal to $$$a$$$ and $$$operatorname{XOR}$$$ value of all elements equal to $$$b$$$. What is the shortest possible leng...
1,000
false
true
false
false
false
false
false
false
false
false
2,803
545C
Little Susie listens to fairy tales before bed every day. Today's fairy tale was about wood cutters and the little girl immediately started imagining the choppers cutting wood. She imagined the situation that is described below. There are _n_ trees located along the road at points with coordinates _x_1,u2009_x_2,u2009....
1,500
false
true
false
true
false
false
false
false
false
false
7,660
1930C
Stack has an array $$$a$$$ of length $$$n$$$. He also has an empty set $$$S$$$. Note that $$$S$$$ is not a multiset. He will do the following three-step operation exactly $$$n$$$ times: 1. Select an index $$$i$$$ such that $$$1 leq i leq a$$$. 2. Insert$$$^dagger$$$ $$$a_i + i$$$ into $$$S$$$. 3. Delete $$$a_i$$$ from ...
1,700
false
true
false
false
true
true
false
true
true
false
709
1774C
Little09 and his friends are playing a game. There are $$$n$$$ players, and the temperature value of the player $$$i$$$ is $$$i$$$. The types of environment are expressed as $$$0$$$ or $$$1$$$. When two players fight in a specific environment, if its type is $$$0$$$, the player with a lower temperature value in this en...
1,300
false
true
false
true
false
true
false
false
false
false
1,642
382A
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 the remaining weights on the scales so that the scales were in equilibrium. The scales is in equilibrium if...
1,100
false
true
true
false
false
false
false
false
false
false
8,303
375D
You have a rooted tree consisting of _n_ vertices. Each vertex of the tree has some color. We will assume that the tree vertices are numbered by integers from 1 to _n_. Then we represent the color of vertex _v_ as _c__v_. The tree root is a vertex with number 1. In this problem you need to answer to _m_ queries. Each q...
2,400
false
false
false
false
true
false
false
false
false
false
8,328
1523G
William owns a flat in central London. He decided to rent his flat out for the next $$$n$$$ days to earn some money. Since his flat is in the center of the city, he instantly got $$$m$$$ offers in the form $$$(l_i, r_i)$$$, which means that someone wants to book the flat from day $$$l_i$$$ until day $$$r_i$$$ inclusive...
3,200
false
false
false
false
true
false
false
false
false
false
3,044
1389F
Problem - 1389F - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
2,600
false
false
false
true
true
false
false
false
true
false
3,723
501A
Problem - 501A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
900
false
false
true
false
false
false
false
false
false
false
7,830
1932G
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Codeforces Round 927 (Div. 3) Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If...
2,300
true
false
false
false
false
false
false
false
false
true
688
1108F
You are given an undirected weighted connected graph with $$$n$$$ vertices and $$$m$$$ edges without loops and multiple edges. The $$$i$$$-th edge is $$$e_i = (u_i, v_i, w_i)$$$; the distance between vertices $$$u_i$$$ and $$$v_i$$$ along the edge $$$e_i$$$ is $$$w_i$$$ ($$$1 le w_i$$$). The graph is connected, i.u2009...
2,100
false
true
false
false
false
false
false
true
false
true
5,156
1826B
You have an array $$$a$$$ of $$$n$$$ non-negative integers. Let's define $$$f(a, x) = [a_1 bmod x, a_2 bmod x, dots, a_n bmod x]$$$ for some positive integer $$$x$$$. Find the biggest $$$x$$$, such that $$$f(a, x)$$$ is a palindrome. Here, $$$a bmod x$$$ is the remainder of the integer division of $$$a$$$ by $$$x$$$. A...
1,100
true
false
false
false
false
false
false
false
false
false
1,328
604A
Kevin Sun has just finished competing in Codeforces Round #334! The round was 120 minutes long and featured five problems with maximum point values of 500, 1000, 1500, 2000, and 2500, respectively. Despite the challenging tasks, Kevin was uncowed and bulldozed through all of them, distinguishing himself from the herd a...
1,000
false
false
true
false
false
false
false
false
false
false
7,428
1967E2
This is the hard version of the problem. The differences between the two versions are the constraints on $$$n, m, b_0$$$ and the time limit. You can make hacks only if both versions are solved. Little R has counted many sets before, and now she decides to count arrays. Little R thinks an array $$$b_0, ldots, b_n$$$ con...
3,500
true
false
false
true
false
false
false
false
false
false
502
1769B2
Statement is not available on English language В этой версии задачи размеры копируемых файлов не превышают $$$10^{10}$$$ байт. Вы копируете с одного сервера на другой $$$n$$$ файлов размером $$$a_1, a_2, ldots, a_n$$$ байт. Файлы копируются последовательно в заданном порядке. При копировании вы видите два прогресс-бара...
1,400
true
false
false
false
false
false
true
true
false
false
1,683
1136D
At the big break Nastya came to the school dining room. There are $$$n$$$ pupils in the school, numbered from $$$1$$$ to $$$n$$$. Unfortunately, Nastya came pretty late, so that all pupils had already stood in the queue, i.e. Nastya took the last place in the queue. Of course, it's a little bit sad for Nastya, but she ...
1,800
false
true
false
false
false
false
false
false
false
false
5,044
722A
You are given a broken clock. You know, that it is supposed to show time in 12- or 24-hours HH:MM format. In 12-hours format hours change from 1 to 12, while in 24-hours it changes from 0 to 23. In both formats minutes change from 0 to 59. You are given a time in format HH:MM that is currently displayed on the broken c...
1,300
false
false
true
false
false
false
true
false
false
false
6,926
1788A
You are given a sequence $$$a_1, a_2, ldots, a_n$$$. Each element of $$$a$$$ is $$$1$$$ or $$$2$$$. Find out if an integer $$$k$$$ exists so that the following conditions are met. $$$1 leq k leq n-1$$$, and $$$a_1 cdot a_2 cdot ldots cdot a_k = a_{k+1} cdot a_{k+2} cdot ldots cdot a_n$$$. If there exist multiple $$$k...
800
true
false
true
false
false
false
true
false
false
false
1,554
1487F
Problem - 1487F - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
2,900
false
true
false
true
false
false
false
false
false
false
3,241
1059A
Vasya has recently got a job as a cashier at a local store. His day at work is $$$L$$$ minutes long. Vasya has already memorized $$$n$$$ regular customers, the $$$i$$$-th of which comes after $$$t_{i}$$$ minutes after the beginning of the day, and his service consumes $$$l_{i}$$$ minutes. It is guaranteed that no custo...
1,000
false
false
true
false
false
false
false
false
false
false
5,421
359D
Problem - 359D - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
2,000
true
false
false
false
true
false
true
true
false
false
8,396
1438A
Andre has very specific tastes. Recently he started falling in love with arrays. Andre calls an nonempty array $$$b$$$ good, if sum of its elements is divisible by the length of this array. For example, array $$$[2, 3, 1]$$$ is good, as sum of its elementsxa0— $$$6$$$xa0— is divisible by $$$3$$$, but array $$$[1, 1, 2,...
800
false
false
true
false
false
true
false
false
false
false
3,478
1354D
Note that the memory limit is unusual. You are given a multiset consisting of $$$n$$$ integers. You have to process queries of two types: add integer $$$k$$$ into the multiset; find the $$$k$$$-th order statistics in the multiset and remove it. $$$k$$$-th order statistics in the multiset is the $$$k$$$-th element in ...
1,900
false
false
false
false
true
false
false
true
false
false
3,935
633G
Yash loves playing with trees and gets especially excited when they have something to do with prime numbers. On his 20th birthday he was granted with a rooted tree of _n_ nodes to answer queries on. Hearing of prime numbers on trees, Yash gets too intoxicated with excitement and asks you to help out and answer queries ...
2,800
true
false
false
false
true
false
false
false
false
false
7,269
1250A
Polycarp recently signed up to a new social network Berstagram. He immediately published $$$n$$$ posts there. He assigned numbers from $$$1$$$ to $$$n$$$ to all posts and published them one by one. So, just after publishing Polycarp's news feed contained posts from $$$1$$$ to $$$n$$$ — the highest post had number $$$1$...
1,400
false
false
true
false
false
false
false
false
false
false
4,455
51A
Cheaterius is a famous in all the Berland astrologist, magician and wizard, and he also is a liar and a cheater. One of his latest inventions is Cheaterius' amulets! They bring luck and wealth, but are rather expensive. Cheaterius makes them himself. The technology of their making is kept secret. But we know that throu...
1,300
false
false
true
false
false
false
false
false
false
false
9,719
545E
Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than solving problems, but she found this problem too interesting, so she wanted to know its solution and decided to ask you about it. So, the problem statement is as follows. Let's assume that we are given a co...
2,000
false
true
false
false
false
false
false
false
false
true
7,658
1070G
Polycarp is an introvert person. In fact he is so much of an introvert that he plays "Monsters and Potions" board game alone. The board of the game is a row of $$$n$$$ cells. The cells are numbered from $$$1$$$ to $$$n$$$ from left to right. There are three types of cells: a cell containing a single monster, a cell con...
2,300
false
true
true
true
false
false
true
false
false
false
5,361
1451A
Problem - 1451A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - ...
800
true
true
false
false
false
false
false
false
false
false
3,428
1856C
You are given an array of integers $$$a$$$ of length $$$n$$$. In one operation you: Choose an index $$$i$$$ such that $$$1 le i le n - 1$$$ and $$$a_i le a_{i + 1}$$$. Increase $$$a_i$$$ by $$$1$$$. Find the maximum possible value of $$$max(a_1, a_2, ldots a_n)$$$ that you can get after performing this operation at m...
1,600
false
false
false
true
true
false
true
true
false
false
1,148
1100C
NN is an experienced internet user and that means he spends a lot of time on the social media. Once he found the following image on the Net, which asked him to compare the sizes of inner circles: It turned out that the circles are equal. NN was very surprised by this fact, so he decided to create a similar picture hims...
1,200
true
false
false
false
false
false
false
true
false
false
5,204
512D
Fox Ciel is going to travel to New Foxland during this summer. New Foxland has _n_ attractions that are linked by _m_ undirected roads. Two attractions are called adjacent if they are linked by a road. Fox Ciel has _k_ days to visit this city and each day she will visit exactly one attraction. There is one important ru...
2,900
false
false
false
true
false
false
false
false
false
false
7,795
1569B
A chess tournament will be held soon, where $$$n$$$ chess players will take part. Every participant will play one game against every other participant. Each game ends in either a win for one player and a loss for another player, or a draw for both players. Each of the players has their own expectations about the tourna...
1,000
false
false
false
false
false
true
false
false
false
false
2,797
1759A
You talked to Polycarp and asked him a question. You know that when he wants to answer "yes", he repeats Yes many times in a row. Because of the noise, you only heard part of the answerxa0— some substring of it. That is, if he answered YesYes, then you could hear esY, YesYes, sYes, e, but you couldn't Yess, YES or se. ...
800
false
false
true
false
false
false
false
false
false
false
1,762
869C
— This is not playing but duty as allies of justice, Nii-chan! — Not allies but justice itself, Onii-chan! With hands joined, go everywhere at a speed faster than our thoughts! This time, the Fire Sistersxa0— Karen and Tsukihixa0— is heading for somewhere they've never reachedxa0— water-surrounded islands! There are th...
1,800
true
false
false
true
false
false
false
false
false
false
6,264
1613C
Monocarp is playing yet another computer game. In this game, his character has to kill a dragon. The battle with the dragon lasts $$$100^{500}$$$ seconds, during which Monocarp attacks the dragon with a poisoned dagger. The $$$i$$$-th attack is performed at the beginning of the $$$a_i$$$-th second from the battle start...
1,200
false
false
false
false
false
false
false
true
false
false
2,574
1039E
While some people enjoy spending their time solving programming contests, Dina prefers taking beautiful pictures. As soon as Byteland Botanical Garden announced Summer Oenothera Exhibition she decided to test her new camera there. The exhibition consists of $$$l = 10^{100}$$$ Oenothera species arranged in a row and con...
3,400
false
false
false
false
true
false
false
false
false
false
5,498
191A
The ancient Berlanders believed that the longer the name, the more important its bearer is. Thus, Berland kings were famous for their long names. But long names are somewhat inconvenient, so the Berlanders started to abbreviate the names of their kings. They called every king by the first letters of its name. Thus, the...
1,500
false
false
false
true
false
false
false
false
false
false
9,077
837A
Problem - 837A - Codeforces =============== xa0 — length of the text. The second line contains text of single-space separated words _s_1,u2009_s_2,u2009...,u2009_s__i_, consisting only of small and capital Latin letters. Output Print one integer number — volume of text. Examples Input 7 NonZERO Output 5...
800
false
false
true
false
false
false
false
false
false
false
6,421
383B
Iahub got lost in a very big desert. The desert can be represented as a _n_u2009×u2009_n_ square matrix, where each cell is a zone of the desert. The cell (_i_,u2009_j_) represents the cell at row _i_ and column _j_ (1u2009≤u2009_i_,u2009_j_u2009≤u2009_n_). Iahub can go from one cell (_i_,u2009_j_) only down or right, ...
2,500
false
false
true
false
false
false
false
true
true
false
8,297
1475G
Polycarp found on the street an array $$$a$$$ of $$$n$$$ elements. Polycarp invented his criterion for the beauty of an array. He calls an array $$$a$$$ beautiful if at least one of the following conditions must be met for each different pair of indices $$$i e j$$$: $$$a_i$$$ is divisible by $$$a_j$$$; or $$$a_j$$$ ...
1,900
true
false
false
true
false
false
false
false
true
false
3,298
1286B
Evlampiy was gifted a rooted tree. The vertices of the tree are numbered from $$$1$$$ to $$$n$$$. Each of its vertices also has an integer $$$a_i$$$ written on it. For each vertex $$$i$$$, Evlampiy calculated $$$c_i$$$xa0— the number of vertices $$$j$$$ in the subtree of vertex $$$i$$$, such that $$$a_j < a_i$$$. Illus...
1,800
false
true
false
false
true
true
false
false
false
true
4,260
1827B1
The only difference between this problem and the hard version is the constraints on $$$t$$$ and $$$n$$$. You are given an array $$$a$$$, consisting of $$$n$$$ distinct integers $$$a_1, a_2, ldots, a_n$$$. Define the beauty of an array $$$p_1, p_2, ldots p_k$$$ as the minimum amount of time needed to sort this array usi...
2,000
false
true
false
true
false
false
false
true
false
false
1,322
1815B
This is an interactive problem. There is a hidden permutation $$$p_1, p_2, dots, p_n$$$. Consider an undirected graph with $$$n$$$ nodes only with no edges. You can make two types of queries: 1. Specify an integer $$$x$$$ satisfying $$$2 le x le 2n$$$. For all integers $$$i$$$ ($$$1 le i le n$$$) such that $$$1 le x-i ...
2,000
false
false
true
false
false
true
true
false
false
true
1,380
745A
Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how to spell the word. Hongcow has decided to try to make new words from this one. He starts by taking the word he just learned how to spell, and moves the last character o...
900
false
false
true
false
false
false
false
false
false
false
6,819
526A
In this problem you will meet the simplified model of game King of Thieves. In a new ZeptoLab game called "King of Thieves" your aim is to reach a chest with gold by controlling your character, avoiding traps and obstacles on your way. An interesting feature of the game is that you can design your own levels that will ...
1,300
false
false
true
false
false
false
true
false
false
false
7,731
630E
Developing tools for creation of locations maps for turn-based fights in a new game, Petya faced the following problem. A field map consists of hexagonal cells. Since locations sizes are going to be big, a game designer wants to have a tool for quick filling of a field part with identical enemy units. This action will ...
1,900
true
false
false
false
false
false
false
false
false
false
7,300
935E
Ancient Egyptians are known to have understood difficult concepts in mathematics. The ancient Egyptian mathematician Ahmes liked to write a kind of arithmetic expressions on papyrus paper which he called as Ahmes arithmetic expression. An Ahmes arithmetic expression can be defined as: "_d_" is an Ahmes arithmetic expr...
2,300
false
false
false
true
false
false
false
false
false
false
5,960
297D
Even polar bears feel cold when lying on the ice. Therefore, a polar bear Alice is going to make a carpet. The carpet can be viewed as a grid with height _h_ and width _w_. Then the grid is divided into _h_u2009×u2009_w_ squares. Alice is going to assign one of _k_ different colors to each square. The colors are number...
2,500
false
false
false
false
false
true
false
false
false
false
8,641
932D
Problem - 932D - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
2,200
false
false
false
true
false
false
false
true
false
false
5,975
990B
You have a Petri dish with bacteria and you are preparing to dive into the harsh micro-world. But, unfortunately, you don't have any microscope nearby, so you can't watch them. You know that you have $$$n$$$ bacteria in the Petri dish and size of the $$$i$$$-th bacteria is $$$a_i$$$. Also you know intergalactic positiv...
1,200
false
true
false
false
false
false
false
false
true
false
5,751
1796D
You are given an array $$$a_1, a_2, dots, a_n$$$, consisting of $$$n$$$ integers. You are also given two integers $$$k$$$ and $$$x$$$. You have to perform the following operation exactly once: add $$$x$$$ to the elements on exactly $$$k$$$ distinct positions, and subtract $$$x$$$ from all the others. For example, if $$...
2,000
false
true
false
true
true
false
false
false
false
false
1,499
1722D
There are $$$n$$$ people in a horizontal line, each looking either to the left or the right. Each person counts the number of people in the direction they are looking. The value of the line is the sum of each person's count. For example, in the arrangement LRRLL, where L stands for a person looking left and R stands fo...
1,100
false
true
false
false
false
false
false
false
true
false
1,950
1731E
You are given an initially empty undirected graph with $$$n$$$ nodes, numbered from $$$1$$$ to $$$n$$$ (i.xa0e. $$$n$$$ nodes and $$$0$$$ edges). You want to add $$$m$$$ edges to the graph, so the graph won't contain any self-loop or multiple edges. If an edge connecting two nodes $$$u$$$ and $$$v$$$ is added, its weig...
2,000
true
true
false
true
false
false
false
false
false
false
1,901
1290F
You are given $$$n$$$ pairwise non-collinear two-dimensional vectors. You can make shapes in the two-dimensional plane with these vectors in the following fashion: 1. Start at the origin $$$(0, 0)$$$. 2. Choose a vector and add the segment of the vector to the current point. For example, if your current point is at $$$...
3,500
false
false
false
true
false
false
false
false
false
false
4,241
1784E
Alice and Bob are playing an infinite game consisting of sets. Each set consists of rounds. In each round, one of the players wins. The first player to win two rounds in a set wins this set. Thus, a set always ends with the score of $$$2:0$$$ or $$$2:1$$$ in favor of one of the players. Let's call a game scenario a fin...
3,100
false
false
false
true
false
false
true
false
false
false
1,568
491A
Hiking club "Up the hill" just returned from a walk. Now they are trying to remember which hills they've just walked through. It is known that there were _N_ stops, all on different integer heights between 1 and _N_ kilometers (inclusive) above the sea level. On the first day they've traveled from the first stop to the...
1,000
false
false
true
false
false
true
false
false
false
false
7,871
2037G
You are exploring the stunning region of Natlan! This region consists of $$$n$$$ cities, and each city is rated with an attractiveness $$$a_i$$$. A directed edge exists from City $$$i$$$ to City $$$j$$$ if and only if $$$i < j$$$ and $$$gcd(a_i,a_j) eq 1$$$, where $$$gcd(x, y)$$$ denotes the — the number of cities. The...
2,000
true
false
false
true
true
false
false
false
false
false
39
126C
After years of hard work scientists invented an absolutely new e-reader display. The new display has a larger resolution, consumes less energy and its production is cheaper. And besides, one can bend it. The only inconvenience is highly unusual management. For that very reason the developers decided to leave the e-read...
2,000
false
true
false
false
false
true
false
false
false
false
9,375
708A
Problem - 708A - Codeforces =============== xa0 ]( --- Finished → Virtual participation Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests. If you've seen these problems, a virtual contest is not for you - s...
1,200
false
true
true
false
false
true
false
false
false
false
6,989