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
1110D
You are playing a game of Jongmah. You don't need to know the rules to solve this problem. You have $$$n$$$ tiles in your hand. Each tile has an integer between $$$1$$$ and $$$m$$$ written on it. To win the game, you will need to form some number of triples. Each triple consists of three tiles, such that the numbers wr...
2,200
false
false
false
true
false
false
false
false
false
false
5,146
1930E
Stack has an array $$$a$$$ of length $$$n$$$ such that $$$a_i = i$$$ for all $$$i$$$ ($$$1 leq i leq n$$$). He will select a positive integer $$$k$$$ ($$$1 leq k leq lfloor frac{n-1}{2} floor$$$) and do the following operation on $$$a$$$ any number (possibly $$$0$$$) of times. Select a subsequence$$$^dagger$$$ $$$s$$...
2,400
true
false
false
true
false
false
false
false
false
false
706
59B
Problem - 59B - 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 - so...
1,200
false
false
true
false
false
false
false
false
false
false
9,679
803G
You are given an array _a_ consisting of positive integers and _q_ queries to this array. There are two types of queries: 1 _l_ _r_ _x_ — for each index _i_ such that _l_u2009≤u2009_i_u2009≤u2009_r_ set _a__i_u2009=u2009_x_. 2 _l_ _r_ — find the minimum among such _a__i_ that _l_u2009≤u2009_i_u2009≤u2009_r_. We decid...
2,300
false
false
false
false
true
false
false
false
false
false
6,546
691A
Problem - 691A - Codeforces =============== xa0 — the number of buttons on the jacket. The second line contains _n_ integers _a__i_ (0u2009≤u2009_a__i_u2009≤u20091). The number _a__i_u2009=u20090 if the _i_-th button is not fastened. Otherwise _a__i_u2009=u20091. Output In the only line print the word "YE...
1,000
false
false
true
false
false
false
false
false
false
false
7,047
1397B
Let's call a list of positive integers $$$a_0, a_1, ..., a_{n-1}$$$ a power sequence if there is a positive integer $$$c$$$, so that for every $$$0 le i le n-1$$$ then $$$a_i = c^i$$$. Given a list of $$$n$$$ positive integers $$$a_0, a_1, ..., a_{n-1}$$$, you are allowed to: Reorder the list (i.e. pick a permutation ...
1,500
true
false
false
false
false
false
true
false
true
false
3,687
479A
Problem - 479A - 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
true
false
false
false
false
false
true
false
false
false
7,916
1496B
You are given a multiset $$$S$$$ initially consisting of $$$n$$$ distinct non-negative integers. A multiset is a set, that can contain some elements multiple times. You will perform the following operation $$$k$$$ times: Add the element $$$lceilfrac{a+b}{2} ceil$$$ (rounded up) into $$$S$$$, where $$$a = operatorname{...
1,100
true
false
false
false
false
false
false
false
false
false
3,189
123B
Problem - 123B - 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,800
true
false
false
false
false
false
false
false
false
false
9,388
1090A
A conglomerate consists of $$$n$$$ companies. To make managing easier, their owners have decided to merge all companies into one. By law, it is only possible to merge two companies, so the owners plan to select two companies, merge them into one, and continue doing so until there is only one company left. But anti-mono...
1,300
false
true
false
false
false
false
false
false
false
false
5,272
1585B
Problem - 1585B - Codeforces =============== xa0 ") Editorial") . The right part contains the elements of $$$a$$$ that are strictly greater than $$$x$$$ ($$$> x$$$). The order of elements in each part is kept the same as before the operation, i.xa0e. the partition is stable. Then the array is replaced with...
900
false
true
false
false
false
false
false
false
false
false
2,701
101C
Problem - 101C - 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
true
false
false
false
false
false
false
false
9,477
980C
Professor Ibrahim has prepared the final homework for his algorithm’s class. He asked his students to implement the Posterization Image Filter. Their algorithm will be tested on an array of integers, where the $$$i$$$-th integer represents the color of the $$$i$$$-th pixel in the image. The image is in black and white,...
1,700
false
true
false
false
false
false
false
false
false
false
5,804
471B
It's time polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev got down to business. In total, there are _n_ tasks for the day and each animal should do each of these tasks. For each task, they have evaluated its difficulty. Also animals decided to do the tasks in ord...
1,300
false
false
true
false
false
false
false
false
true
false
7,951
3A
Problem - 3A - Codeforces =============== xa0 . Input The first line contains the chessboard coordinates of square _s_, the second line — of square _t_. Chessboard coordinates consist of two characters, the first one is a lowercase Latin letter (from a to h), the second one is a digit from 1 to 8. Out...
1,000
false
true
false
false
false
false
false
false
false
false
9,978
1267E
Byteburg Senate elections are coming. Usually "United Byteland", the ruling Byteland party, takes all the seats in the Senate to ensure stability and sustainable development. But this year there is one opposition candidate in one of the constituencies. Even one opposition member can disturb the stability in the Senate,...
1,700
false
true
false
false
false
false
false
false
false
false
4,359
1284C
Recall that the permutation is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is $$$...
1,600
true
false
false
false
false
false
false
false
false
false
4,272
1668A
You are given a grid with $$$n$$$ rows and $$$m$$$ columns. Rows and columns are numbered from $$$1$$$ to $$$n$$$, and from $$$1$$$ to $$$m$$$. The intersection of the $$$a$$$-th row and $$$b$$$-th column is denoted by $$$(a, b)$$$. Initially, you are standing in the top left corner $$$(1, 1)$$$. Your goal is to reach ...
800
true
false
true
false
false
false
false
false
false
false
2,267
1924A
You are given two integers $$$n$$$ and $$$k$$$ along with a string $$$s$$$. Your task is to check whether all possible strings of length $$$n$$$ that can be formed using the first $$$k$$$ lowercase English alphabets occur as a subsequence of $$$s$$$. If the answer is NO, you also need to print a string of length $$$n$$...
1,500
false
true
false
true
false
true
false
false
false
false
746
696B
Barney lives in country USC (United States of Charzeh). USC has _n_ cities numbered from 1 through _n_ and _n_u2009-u20091 roads between them. Cities and roads of USC form a rooted tree (Barney's not sure why it is rooted). Root of the tree is the city number 1. Thus if one will start his journey from city 1, he can vi...
1,700
true
false
false
false
false
false
false
false
false
false
7,040
1446B
You are given two strings $$$A$$$ and $$$B$$$ representing essays of two students who are suspected cheaters. For any two strings $$$C$$$, $$$D$$$ we define their similarity score $$$S(C,D)$$$ as $$$4cdot LCS(C,D) - C - D$$$, where $$$LCS(C,D)$$$ denotes the length of the Longest Common Subsequence of strings $$$C$$$ a...
1,800
false
false
false
true
false
false
false
false
false
false
3,446
508B
Berland, 2016. The exchange rate of currency you all know against the burle has increased so much that to simplify the calculations, its fractional part was neglected and the exchange rate is now assumed to be an integer. Reliable sources have informed the financier Anton of some information about the exchange rate of ...
1,300
true
true
false
false
false
false
false
false
false
false
7,810
639A
Limak is a little polar bear. He loves connecting with other bears via social networks. He has _n_ friends and his relation with the _i_-th of them is described by a unique integer _t__i_. The bigger this value is, the better the friendship is. No two friends have the same value _t__i_. Spring is starting and the Winte...
1,200
false
false
true
false
false
false
false
false
false
false
7,257
350A
Valera wanted to prepare a Codesecrof round. He's already got one problem and he wants to set a time limit (TL) on it. Valera has written _n_ correct solutions. For each correct solution, he knows its running time (in seconds). Valera has also wrote _m_ wrong solutions and for each wrong solution he knows its running t...
1,200
false
true
true
false
false
false
true
false
false
false
8,435
1264B
An integer sequence is called beautiful if the difference between any two consecutive numbers is equal to $$$1$$$. More formally, a sequence $$$s_1, s_2, ldots, s_{n}$$$ is beautiful if $$$s_i - s_{i+1} = 1$$$ for all $$$1 leq i leq n - 1$$$. Trans has $$$a$$$ numbers $$$0$$$, $$$b$$$ numbers $$$1$$$, $$$c$$$ numbers $...
1,900
false
true
false
false
false
true
true
false
false
false
4,380
1527B1
The only difference between the easy and hard versions is that the given string $$$s$$$ in the easy version is initially a palindrome, this condition is not always true for the hard version. A palindrome is a string that reads the same left to right and right to left. For example, "101101" is a palindrome, while "0101"...
1,200
false
false
false
false
false
true
false
false
false
false
3,028
1352D
There are $$$n$$$ candies in a row, they are numbered from left to right from $$$1$$$ to $$$n$$$. The size of the $$$i$$$-th candy is $$$a_i$$$. Alice and Bob play an interesting and tasty game: they eat candy. Alice will eat candy from left to right, and Bob — from right to left. The game ends if all the candies are e...
1,300
false
false
true
false
false
false
false
false
false
false
3,949
748C
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,u2009_p_2,u2009...,u2009_p__m_ with integer coordinates, do the following: denote its initial location by _p_0. First, the robot will move from _p_0 to _p_1 along one of the shortest pa...
1,400
true
false
false
false
false
true
false
false
false
false
6,802
1073F
You are given an undirected unweighted tree consisting of $$$n$$$ vertices. An undirected tree is a connected undirected graph with $$$n - 1$$$ edges. Your task is to choose two pairs of vertices of this tree (all the chosen vertices should be distinct) $$$(x_1, y_1)$$$ and $$$(x_2, y_2)$$$ in such a way that neither $...
2,500
false
true
false
true
false
false
false
false
false
false
5,348
822C
It's well known that the best way to distract from something is to do one's favourite thing. Job is such a thing for Leha. So the hacker began to work hard in order to get rid of boredom. It means that Leha began to hack computers all over the world. For such zeal boss gave the hacker a vacation of exactly _x_ days. Yo...
1,600
false
true
true
false
false
false
false
true
true
false
6,466
1154E
There are $$$n$$$ students standing in a row. Two coaches are forming two teams — the first coach chooses the first team and the second coach chooses the second team. The $$$i$$$-th student has integer programming skill $$$a_i$$$. All programming skills are distinct and between $$$1$$$ and $$$n$$$, inclusive. Firstly, ...
1,800
false
false
true
false
true
false
false
false
true
false
4,939
862C
Problem - 862C - 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,900
false
false
false
false
false
true
false
false
false
false
6,298
1271C
The map of the capital of Berland can be viewed on the infinite coordinate plane. Each point with integer coordinates contains a building, and there are streets connecting every building to four neighbouring buildings. All streets are parallel to the coordinate axes. The main school of the capital is located in $$$(s_x...
1,300
false
true
true
false
false
false
true
false
false
false
4,333
1651D
You are given $$$n$$$ distinct points on a plane. The coordinates of the $$$i$$$-th point are $$$(x_i, y_i)$$$. For each point $$$i$$$, find the nearest (in terms of Manhattan distance) point with integer coordinates that is not among the given $$$n$$$ points. If there are multiple such points — you can choose any of t...
1,900
false
false
false
false
true
false
false
true
false
true
2,365
1A
Problem - 1A - Codeforces =============== xa0 ]( "85") . Output Write the needed number of flagstones. Examples Input 6 6 4 Output 4
1,000
true
false
false
false
false
false
false
false
false
false
9,984
1629A
Did you know you can download more RAM? There is a shop with $$$n$$$ different pieces of software that increase your RAM. The $$$i$$$-th RAM increasing software takes $$$a_i$$$ GB of memory to run (temporarily, once the program is done running, you get the RAM back), and gives you an additional $$$b_i$$$ GB of RAM (per...
800
false
true
false
false
false
false
true
false
true
false
2,468
1089H
, # Problem A. Harder Satisfiability Time limit: 2 seconds A fully quantified boolean 2-CNF formula is a formula in the following form: Q1x1 . . . Q nxn F (x1, . . . , x n).Each Qi is one of two quantifiers: a universal quantifier 8 (“for all”), or an existential quantifier 9 (“exists”); and F is a conjunction (boolea...
3,400
false
false
false
false
false
false
false
false
false
true
5,278
1955C
$$$n$$$ ships set out to explore the depths of the ocean. The ships are numbered from $$$1$$$ to $$$n$$$ and follow each other in ascending order; the $$$i$$$-th ship has a durability of $$$a_i$$$. The Kraken attacked the ships $$$k$$$ times in a specific order. First, it attacks the first of the ships, then the last, ...
1,300
true
true
true
false
false
false
false
false
false
false
546
1955B
A progressive square of size $$$n$$$ is an $$$n imes n$$$ matrix. Maxim chooses three integers $$$a_{1,1}$$$, $$$c$$$, and $$$d$$$ and constructs a progressive square according to the following rules: $$$$$$a_{i+1,j} = a_{i,j} + c$$$$$$ $$$$$$a_{i,j+1} = a_{i,j} + d$$$$$$ For example, if $$$n = 3$$$, $$$a_{1,1} = 1$$$...
1,000
false
false
true
false
true
true
false
false
true
false
547
979D
Kuro is currently playing an educational game about numbers. The game focuses on the greatest common divisor (GCD), the XOR value, and the sum of two numbers. Kuro loves the game so much that he solves levels by levels day by day. Sadly, he's going on a vacation for a day, and he isn't able to continue his solving stre...
2,200
true
true
false
true
true
false
true
true
false
false
5,808
331D3
Don't put up with what you're sick of! The Smart Beaver decided to escape from the campus of Beaver Science Academy (BSA). BSA is a _b_u2009×u2009_b_ square on a plane. Each point _x_,u2009_y_ (0u2009≤u2009_x_,u2009_y_u2009≤u2009_b_) belongs to BSA. To make the path quick and funny, the Beaver constructed a Beaveractor...
3,000
false
false
true
false
true
false
false
false
false
false
8,513
19D
Pete and Bob invented a new interesting game. Bob takes a sheet of paper and locates a Cartesian coordinate system on it as follows: point (0,u20090) is located in the bottom-left corner, _Ox_ axis is directed right, _Oy_ axis is directed up. Pete gives Bob requests of three types: add x y — on the sheet of paper Bob ...
2,800
false
false
false
false
true
false
false
false
false
false
9,897
89A
It is nighttime and Joe the Elusive got into the country's main bank's safe. The safe has _n_ cells positioned in a row, each of them contains some amount of diamonds. Let's make the problem more comfortable to work with and mark the cells with positive numbers from 1 to _n_ from the left to the right. Unfortunately, J...
1,800
false
true
false
false
false
false
false
false
false
false
9,529
86B
Physicist Woll likes to play one relaxing game in between his search of the theory of everything. Game interface consists of a rectangular _n_u2009×u2009_m_ playing field and a dashboard. Initially some cells of the playing field are filled while others are empty. Dashboard contains images of all various connected (we ...
2,200
true
true
false
false
false
true
false
false
false
false
9,540
72A
Goshtasp was known to be a good programmer in his school. One day Vishtasp, Goshtasp's friend, asked him to solve this task: Given a positive integer _n_, you should determine whether _n_ is rich. The positive integer _x_ is rich, if there exists some set of distinct numbers _a_1,u2009_a_2,u2009...,u2009_a__m_ such tha...
1,800
true
true
false
false
false
false
false
false
false
false
9,611
1910A
On the official website of Berland, each account has two parameters: username and ID. Username is a string consisting of lowercase Latin letters and/or digits, which contains at least one letter. For example, user0, 1fox1, zzzz are correct usernames, but 1337 and User22 are not. The ID of the account for a given userna...
1,100
false
false
true
false
false
false
false
false
false
false
847
329C
I have an undirected graph consisting of _n_ nodes, numbered 1 through _n_. Each node has at most two incident edges. For each pair of nodes, there is at most an edge connecting them. No edge connects a node to itself. I would like to create a new graph in such a way that: The new graph consists of the same number of ...
2,400
false
false
false
false
false
true
false
false
false
false
8,527
621A
Problem - 621A - 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,351
909B
Problem - 909B - 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,300
true
false
false
false
false
true
false
false
false
false
6,111
815A
On the way to school, Karen became fixated on the puzzle game on her phone! The game is played as follows. In each level, you have a grid with _n_ rows and _m_ columns. Each cell originally contains the number 0. One move consists of choosing one row or column, and adding 1 to all of the cells in that row or column. To...
1,700
false
true
true
false
false
false
true
false
false
false
6,500
1930A
There are $$$2n$$$ positive integers written on a whiteboard. Being bored, you decided to play a one-player game with the numbers on the whiteboard. You start with a score of $$$0$$$. You will increase your score by performing the following move exactly $$$n$$$ times: Choose two integers $$$x$$$ and $$$y$$$ that are w...
800
false
true
false
false
false
false
false
false
true
false
711
436B
Om Nom really likes candies and doesn't like spiders as they frequently steal candies. One day Om Nom fancied a walk in a park. Unfortunately, the park has some spiders and Om Nom doesn't want to see them at all. The park can be represented as a rectangular _n_u2009×u2009_m_ field. The park has _k_ spiders, each spider...
1,400
true
false
true
false
false
false
false
false
false
false
8,096
1659C
You are an ambitious king who wants to be the Emperor of The Reals. But to do that, you must first become Emperor of The Integers. Consider a number axis. The capital of your empire is initially at $$$0$$$. There are $$$n$$$ unconquered kingdoms at positions $$$0<x_1<x_2<ldots<x_n$$$. You want to conquer all other king...
1,500
true
true
true
true
false
false
true
true
false
false
2,330
356C
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 that if one compartment contain one or two students, then they ...
2,100
false
true
true
false
false
true
false
false
false
false
8,409
1983F
You have an array of non-negative integers $$$a_1, a_2, ldots, a_n$$$. The value of a sub-array of length $$$ge 2$$$, $$$a[l, r] = [a_l, a_{l+1}, ldots, a_r]$$$ is the minimum value of $$$a_i oplus a_j$$$ such that $$$l le i < j le r$$$, where $$$oplus$$$ is the xor (exclusive-or) operator. You have to find the $$$k$$$...
2,500
false
true
false
false
true
false
false
true
false
false
385
679E
Limak, a bear, isn't good at handling queries. So, he asks you to do it. We say that powers of 42 (numbers 1,u200942,u20091764,u2009...) are bad. Other numbers are good. You are given a sequence of _n_ good integers _t_1,u2009_t_2,u2009...,u2009_t__n_. Your task is to handle _q_ queries of three types: 1. 1 ixa0— print...
3,100
false
false
false
false
true
false
false
false
false
false
7,106
1227G
You are given an integer array $$$a_1, a_2, dots, a_n$$$, where $$$a_i$$$ represents the number of blocks at the $$$i$$$-th position. It is guaranteed that $$$1 le a_i le n$$$. In one operation you can choose a subset of indices of the given array and remove one block in each of these indices. You can't remove a block ...
2,600
false
false
false
false
false
true
false
false
false
false
4,536
1982D
Nikita loves mountains and has finally decided to visit the Berlyand mountain range! The range was so beautiful that Nikita decided to capture it on a map. The map is a table of $$$n$$$ rows and $$$m$$$ columns, with each cell containing a non-negative integer representing the height of the mountain. He also noticed th...
1,700
true
false
true
false
true
false
true
false
false
false
393
550E
Implication is a function of two logical arguments, its value is false if and only if the value of the first argument is true and the value of the second argument is false. Implication is written by using character '', and the arguments and the result of the implication are written as '0' (_false_) and '1' (_true_). Ac...
2,200
true
true
true
false
false
true
false
false
false
false
7,633
1656E
You are given an undirected unrooted tree, i.e. a connected undirected graph without cycles. You must assign a nonzero integer weight to each vertex so that the following is satisfied: if any vertex of the tree is removed, then each of the remaining connected components has the same sum of weights in its vertices. Inpu...
2,200
true
false
false
false
false
true
false
false
false
false
2,350
120D
Three sons inherited from their father a rectangular corn fiend divided into _n_u2009×u2009_m_ squares. For each square we know how many tons of corn grows on it. The father, an old farmer did not love all three sons equally, which is why he bequeathed to divide his field into three parts containing _A_, _B_ and _C_ to...
1,400
false
false
false
false
false
false
true
false
false
false
9,403
1765E
Monocarp is playing a MMORPG. There are two commonly used types of currency in this MMORPG — gold coins and silver coins. Monocarp wants to buy a new weapon for his character, and that weapon costs $$$n$$$ silver coins. Unfortunately, right now, Monocarp has no coins at all. Monocarp can earn gold coins by completing q...
1,000
true
false
false
false
false
false
true
false
false
false
1,713
1726C
Last summer, Feluda gifted Lalmohan-Babu a balanced bracket sequence $$$s$$$ of length $$$2 n$$$. Topshe was bored during his summer vacations, and hence he decided to draw an undirected graph of $$$2 n$$$ vertices using the balanced bracket sequence $$$s$$$. For any two distinct vertices $$$i$$$ and $$$j$$$ ($$$1 le i...
1,300
false
true
false
false
true
false
false
false
false
true
1,931
1365C
# Rotation Matching Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes After the mysterious disappearance of Ashish, his two favourite disciples Ishika and Hriday, were each left with one half of a secret message. These messages can each be represented by a permu...
1,400
false
true
true
false
true
true
false
false
false
false
3,855
1874A
Jellyfish has $$$n$$$ green apples with values $$$a_1, a_2, dots, a_n$$$ and Gellyfish has $$$m$$$ green apples with values $$$b_1,b_2,ldots,b_m$$$. They will play a game with $$$k$$$ rounds. For $$$i=1,2,ldots,k$$$ in this order, they will perform the following actions: If $$$i$$$ is odd, Jellyfish can choose to swap...
1,200
false
true
true
false
false
false
true
false
false
false
1,036
1495E
Qingshan and Daniel are going to play a card game. But it will be so boring if only two persons play this. So they will make $$$n$$$ robots in total to play this game automatically. Robots made by Qingshan belong to the team $$$1$$$, and robots made by Daniel belong to the team $$$2$$$. Robot $$$i$$$ belongs to team $$...
3,200
false
true
true
false
true
false
true
false
false
false
3,192
64E
Problem - 64E - Codeforces =============== xa0 and _a_,u2009_b_ are primes. Input The only given line contains an integer number _n_ (2u2009≤u2009_n_u2009≤u200910000). Output Print the space separated pair of the required numbers _a_, _b_. Examples Input 10 Output 7 11 Input 97 Output 97 97
1,800
true
false
false
false
false
false
true
false
false
false
9,651
379E
Due to atheistic Soviet past, Christmas wasn't officially celebrated in Russia for most of the twentieth century. As a result, the Russian traditions for Christmas and New Year mixed into one event celebrated on the New Year but including the tree, a Santa-like 'Grandfather Frost', presents and huge family reunions and...
2,500
false
false
false
false
false
false
false
false
true
false
8,313
620F
You are given an array with _n_ integers _a__i_ and _m_ queries. Each query is described by two integers (_l__j_,u2009_r__j_). Let's define the function . The function is defined for only _u_u2009≤u2009_v_. For each query print the maximal value of the function _f_(_a__x_,u2009_a__y_) over all _l__j_u2009≤u2009_x_,u200...
2,800
false
false
false
false
true
false
false
false
false
false
7,352
1984H
There are $$$n$$$ towers at $$$n$$$ distinct points $$$(x_1, y_1), (x_2, y_2), ldots, (x_n, y_n)$$$, such that no three are collinear and no four are concyclic. Initially, you own towers $$$(x_1, y_1)$$$ and $$$(x_2, y_2)$$$, and you want to capture all of them. To do this, you can do the following operation any number...
3,300
false
false
false
true
false
false
false
false
false
false
375
1323A
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by $$$2$$$) or determine that there is no such subset. Both the given array and required subset may contain equal values. Input The first line contains a single int...
800
false
true
true
true
false
false
true
false
false
false
4,101
637A
After celebrating the midcourse the students of one of the faculties of the Berland State University decided to conduct a vote for the best photo. They published the photos in the social network and agreed on the rules to choose a winner: the photo which gets most likes wins. If multiple photoes get most likes, the win...
1,000
false
false
true
false
false
true
false
false
false
false
7,265
1826E
A fashion tour consists of $$$m$$$ identical runway shows in different cities. There are $$$n$$$ models willing to participate in the tour, numbered from $$$1$$$ to $$$n$$$. People in different cities have different views on the fashion industry, so they rate each model differently. In particular, people in city $$$i$$...
2,400
false
false
true
true
true
false
true
false
true
true
1,325
570A
The country of Byalechinsk is running elections involving _n_ candidates. The country consists of _m_ cities. We know how many people in each city voted for each candidate. The electoral system in the country is pretty unusual. At the first stage of elections the votes are counted for each city: it is assumed that in e...
1,100
false
false
true
false
false
false
false
false
false
false
7,571
1038C
Two players A and B have a list of $$$n$$$ integers each. They both want to maximize the subtraction between their score and their opponent's score. In one turn, a player can either add to his score any element from his list (assuming his list is not empty), the element is removed from the list afterward. Or remove an ...
1,300
false
true
false
false
false
false
false
false
true
false
5,506
1352G
A permutation of length $$$n$$$ is an array $$$p=[p_1,p_2,dots,p_n]$$$, which contains every integer from $$$1$$$ to $$$n$$$ (inclusive) and, moreover, each number appears exactly once. For example, $$$p=[3,1,4,2,5]$$$ is a permutation of length $$$5$$$. For a given number $$$n$$$ ($$$n ge 2$$$), find a permutation $$$...
1,600
false
false
false
false
false
true
false
false
false
false
3,946
1770F
Mari has three integers $$$n$$$, $$$x$$$, and $$$y$$$. Call an array $$$a$$$ of $$$n$$$ non-negative integers good if it satisfies the following conditions: $$$a_1+a_2+ldots+a_n=x$$$, and $$$a_1 , , a_2 , , ldots , , a_n=y$$$, where $$$$$$ denotes the . Output Output a single integer — the total bitwise XOR of the...
3,100
true
false
false
true
false
false
false
false
false
false
1,672
746B
Polycarp is mad about coding, that is why he writes Sveta encoded messages. He calls the median letter in a word the letter which is in the middle of the word. If the word's length is even, the median letter is the left of the two middle letters. In the following examples, the median letter is highlighted: contest, inf...
900
false
false
true
false
false
false
false
false
false
false
6,816
468C
Problem - 468C - 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,500
true
false
false
false
false
true
false
true
false
false
7,965
1582A
Luntik has decided to try singing. He has $$$a$$$ one-minute songs, $$$b$$$ two-minute songs and $$$c$$$ three-minute songs. He wants to distribute all songs into two concerts such that every song should be included to exactly one concert. He wants to make the absolute difference of durations of the concerts as small a...
800
true
false
false
false
false
false
false
false
false
false
2,725
1406E
This is an interactive problem. There is an unknown integer $$$x$$$ ($$$1le xle n$$$). You want to find $$$x$$$. At first, you have a set of integers $$${1, 2, ldots, n}$$$. You can perform the following operations no more than $$$10000$$$ times: A $$$a$$$: find how many numbers are multiples of $$$a$$$ in the current...
2,600
true
false
false
false
false
false
false
false
false
false
3,642
1689E
Bit Lightyear, to the ANDfinity and beyond! After graduating from computer sciences, Vlad has been awarded an array $$$a_1,a_2,ldots,a_n$$$ of $$$n$$$ non-negative integers. As it is natural, he wanted to construct a graph consisting of $$$n$$$ vertices, numbered $$$1, 2,ldots, n$$$. He decided to add an edge between $...
2,500
false
false
false
false
false
true
true
false
false
true
2,144
1910I
Consider the following problem. You are given a string $$$s$$$, consisting of $$$n$$$ lowercase Latin letters, and an integer $$$k$$$ ($$$n$$$ is not divisible by $$$k$$$). Each letter is one of the first $$$c$$$ letters of the alphabet. You apply the following operation until the length of the string is less than $$$k...
2,700
false
false
false
true
false
false
false
false
false
false
839
963C
A rectangle with sides $$$A$$$ and $$$B$$$ is cut into rectangles with cuts parallel to its sides. For example, if $$$p$$$ horizontal and $$$q$$$ vertical cuts were made, $$$(p + 1) cdot (q + 1)$$$ rectangles were left after the cutting. After the cutting, rectangles were of $$$n$$$ different types. Two rectangles are ...
2,600
true
false
false
false
false
false
true
false
false
false
5,847
85B
In an embassy of a well-known kingdom an electronic queue is organised. Every person who comes to the embassy, needs to make the following three actions: show the ID, pay money to the cashier and be fingerprinted. Besides, the actions should be performed in the given order. For each action several separate windows are ...
1,800
false
true
false
false
true
false
false
false
false
false
9,545
1375E
# Inversion SwapSort Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 256 megabytes Madeline has an array a of n integers. A pair (u, v ) of integers forms an inversion in a if: • 1 ≤ u < v ≤ n. • au > a v.Madeline recently found a magical paper, which allows her to write ...
2,500
false
true
false
false
false
true
false
false
true
false
3,783
1948B
You are given an integer array $$$a$$$ of length $$$n$$$. You can perform the following operation any number of times (possibly zero): take any element of the array $$$a$$$, which is at least $$$10$$$, delete it, and instead insert the digits that element consisted of in the same position, in order they appear in that ...
1,100
false
true
true
true
false
false
true
false
false
false
598
1584F
You are given $$$n$$$ strings $$$s_1, s_2, ldots, s_n$$$, each consisting of lowercase and uppercase English letters. In addition, it's guaranteed that each character occurs in each string at most twice. Find the longest common subsequence of these strings. A string $$$t$$$ is a subsequence of a string $$$s$$$ if $$$t$...
2,600
false
true
false
true
false
false
false
false
false
true
2,704
928C
Polycarp is currently developing a project in Vaja language and using a popular dependency management system called Vamen. From Vamen's point of view both Vaja project and libraries are treated projects for simplicity. A project in Vaja has its own uniqie non-empty name consisting of lowercase latin letters with length...
1,900
false
false
true
false
false
false
false
false
false
true
5,992
981H
You are given a tree of $$$n$$$ vertices. You are to select $$$k$$$ (not necessarily distinct) simple paths in such a way that it is possible to split all edges of the tree into three sets: edges not contained in any path, edges that are a part of exactly one of these paths, and edges that are parts of all selected pat...
3,100
true
false
false
true
true
false
false
false
false
false
5,793
622D
Problem - 622D - Codeforces =============== xa0 ]( "Educational Codeforces Round 7") in the permuted array _a_. Let's define the value _d__i_u2009=u2009_y__i_u2009-u2009_x__i_ — the distance between the positions of the number _i_. Permute the numbers in array _a_ to minimize the value of the sum . Input T...
1,900
false
false
false
false
false
true
false
false
false
false
7,343
1166E
Dora the explorer has decided to use her money after several years of juicy royalties to go shopping. What better place to shop than Nlogonia? There are $$$n$$$ stores numbered from $$$1$$$ to $$$n$$$ in Nlogonia. The $$$i$$$-th of these stores offers a positive integer $$$a_i$$$. Each day among the last $$$m$$$ days D...
2,100
true
false
false
false
false
true
true
false
false
false
4,885
1753A2
This is the hard version of the problem. The difference is that in this version the array contains zeros. You can make hacks only if both versions of the problem are solved. You are given an array $$$[a_1, a_2, ldots a_n]$$$ consisting of integers $$$-1$$$, $$$0$$$ and $$$1$$$. You have to build a partition of this arr...
1,500
false
true
false
true
false
true
false
false
false
false
1,776
1984C1
The two versions of the problem are different. You may want to read both versions. You can make hacks only if both versions are solved. You are given an array $$$a$$$ of length $$$n$$$. Start with $$$c = 0$$$. Then, for each $$$i$$$ from $$$1$$$ to $$$n$$$ (in increasing order) do exactly one of the following: Option ...
1,300
true
true
false
true
false
false
false
false
false
false
381
677E
Vanya plays a game of balloons on the field of size _n_u2009×u2009_n_, where each cell contains a balloon with one of the values 0, 1, 2 or 3. The goal is to destroy a cross, such that the product of all values of balloons in the cross is maximum possible. There are two types of crosses: normal and rotated. For example...
2,300
false
false
true
true
false
false
true
true
false
false
7,117
606B
The Cybernetics Failures (CF) organisation made a prototype of a bomb technician robot. To find the possible problems it was decided to carry out a series of tests. At the beginning of each test the robot prototype will be placed in cell (_x_0,u2009_y_0) of a rectangular squared field of size _x_u2009×u2009_y_, after t...
1,600
false
false
true
false
false
false
false
false
false
false
7,420
1207F
Problem - 1207F - 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,100
false
false
true
false
true
false
true
false
false
false
4,656
2020B
Imagine you have $$$n$$$ light bulbs numbered $$$1, 2, ldots, n$$$. Initially, all bulbs are on. To flip the state of a bulb means to turn it off if it used to be on, and to turn it on otherwise. Next, you do the following: for each $$$i = 1, 2, ldots, n$$$, flip the state of all bulbs $$$j$$$ such that $$$j$$$ is div...
1,200
true
false
false
false
false
false
false
true
false
false
151
1754A
You work in the quality control department of technical support for a large company. Your job is to make sure all client issues have been resolved. Today you need to check a copy of a dialog between a client and a technical support manager. According to the rules of work, each message of the client must be followed by ...
800
false
true
false
false
false
false
false
false
false
false
1,770
1477B
Nezzar has a binary string $$$s$$$ of length $$$n$$$ that he wants to share with his best friend, Nanako. Nanako will spend $$$q$$$ days inspecting the binary string. At the same time, Nezzar wants to change the string $$$s$$$ into string $$$f$$$ during these $$$q$$$ days, because it looks better. It is known that Nana...
1,900
false
true
false
false
true
false
false
false
false
false
3,289