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
283B
Farmer John has just given the cows a program to play with! The program contains two integer variables, _x_ and _y_, and performs the following operations on a sequence _a_1,u2009_a_2,u2009...,u2009_a__n_ of positive integers: 1. Initially, _x_u2009=u20091 and _y_u2009=u20090. If, after any step, _x_u2009≤u20090 or _x_...
1,700
false
false
false
true
false
false
false
false
false
true
8,702
1242E
Ujan has finally cleaned up his house and now wants to decorate the interior. He decided to place a beautiful carpet that would really tie the guest room together. He is interested in carpets that are made up of polygonal patches such that each side of a patch is either a side of another (different) patch, or is an ext...
3,200
false
false
false
false
false
true
false
false
false
true
4,485
817A
Captain Bill the Hummingbird and his crew recieved an interesting challenge offer. Some stranger gave them a map, potion of teleportation and said that only this potion might help them to reach the treasure. Bottle with potion has two values _x_ and _y_ written on it. These values define four moves which can be perform...
1,200
true
false
true
false
false
false
false
false
false
false
6,493
1373A
# Donut Shops Input file: standard input Output file: standard output Time limit: 2 seconds Memory limit: 256 megabytes There are two rival donut shops. The first shop sells donuts at retail: each donut costs a dollars. The second shop sells donuts only in bulk: box of b donuts costs c dollars. So if you want to buy...
1,000
true
true
true
false
false
false
false
false
false
false
3,801
1528A
Parsa has a humongous tree on $$$n$$$ vertices. On each vertex $$$v$$$ he has written two integers $$$l_v$$$ and $$$r_v$$$. To make Parsa's tree look even more majestic, Nima wants to assign a number $$$a_v$$$ ($$$l_v le a_v le r_v$$$) to each vertex $$$v$$$ such that the beauty of Parsa's tree is maximized. Nima's sen...
1,600
false
true
false
true
false
false
false
false
false
false
3,023
946F
Problem - 946F - 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,400
false
false
false
true
false
false
false
false
false
false
5,927
1396C
Ziota found a video game called "Monster Invaders". Similar to every other shooting RPG game, "Monster Invaders" involves killing monsters and bosses with guns. For the sake of simplicity, we only consider two different types of monsters and three different types of guns. Namely, the two types of monsters are: a norma...
2,300
false
true
true
true
false
false
false
false
false
false
3,691
732E
The ICM ACPC World Finals is coming! Unfortunately, the organizers of the competition were so busy preparing tasks that totally missed an important technical point — the organization of electricity supplement for all the participants workstations. There are _n_ computers for participants, the _i_-th of which has power ...
2,100
false
true
false
false
false
false
false
false
true
false
6,866
2021E1
This is the easy version of the problem. In the three versions, the constraints on $$$n$$$ and $$$m$$$ are different. You can make hacks only if all the versions of the problem are solved. Pak Chanek is setting up internet connections for the village of Khuntien. The village can be represented as a connected simple gra...
2,300
true
true
true
true
true
false
true
false
false
true
141
543A
Programmers working on a large project have just received a task to write exactly _m_ lines of code. There are _n_ programmers working on a project, the _i_-th of them makes exactly _a__i_ bugs in every line of code that he writes. Let's call a sequence of non-negative integers _v_1,u2009_v_2,u2009...,u2009_v__n_ a pla...
1,800
false
false
false
true
false
false
false
false
false
false
7,669
1085D
You are given a tree (an undirected connected graph without cycles) and an integer $$$s$$$. Vanya wants to put weights on all edges of the tree so that all weights are non-negative real numbers and their sum is $$$s$$$. At the same time, he wants to make the diameter of the tree as small as possible. Let's define the d...
1,700
false
false
true
false
false
true
false
false
false
false
5,296
1661F
Problem - 1661F - 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
false
false
false
true
false
false
2,314
340A
Iahub and his friend Floyd have started painting a wall. Iahub is painting the wall red and Floyd is painting it pink. You can consider the wall being made of a very large number of bricks, numbered 1, 2, 3 and so on. Iahub has the following scheme of painting: he skips _x_u2009-u20091 consecutive bricks, then he paint...
1,200
true
false
false
false
false
false
false
false
false
false
8,475
1462A
Polycarp has a favorite sequence $$$a[1 dots n]$$$ consisting of $$$n$$$ integers. He wrote it out on the whiteboard as follows: he wrote the number $$$a_1$$$ to the left side (at the beginning of the whiteboard); he wrote the number $$$a_2$$$ to the right side (at the end of the whiteboard); then as far to the left...
800
false
false
true
false
false
false
false
false
false
false
3,380
1092E
You are given a forest — an undirected graph with $$$n$$$ vertices such that each its connected component is a tree. The diameter (aka "longest shortest path") of a connected undirected graph is the maximum number of edges in the shortest path between any pair of its vertices. You task is to add some edges (possibly ze...
2,000
false
true
false
false
false
true
false
false
false
false
5,246
1144C
Two integer sequences existed initially — one of them was strictly increasing, and the other one — strictly decreasing. Strictly increasing sequence is a sequence of integers $$$[x_1 < x_2 < dots < x_k]$$$. And strictly decreasing sequence is a sequence of integers $$$[y_1 > y_2 > dots > y_l]$$$. Note that the empty se...
1,000
false
false
false
false
false
true
false
false
true
false
5,003
1032D
In this problem we consider a very simplified model of Barcelona city. Barcelona can be represented as a plane with streets of kind $$$x = c$$$ and $$$y = c$$$ for every integer $$$c$$$ (that is, the rectangular grid). However, there is a detail which makes Barcelona different from Manhattan. There is an avenue called ...
1,900
false
false
true
false
false
false
false
false
false
false
5,539
362D
You must have heard all about the Foolland on your Geography lessons. Specifically, you must know that federal structure of this country has been the same for many centuries. The country consists of _n_ cities, some pairs of cities are connected by bidirectional roads, each road is described by its length _l__i_. The f...
2,100
false
true
false
false
true
false
false
false
false
true
8,384
1217C
You are given a binary string $$$s$$$ (recall that a string is binary if each character is either $$$0$$$ or $$$1$$$). Let $$$f(t)$$$ be the decimal representation of integer $$$t$$$ written in binary form (possibly with leading zeroes). For example $$$f(011) = 3, f(00101) = 5, f(00001) = 1, f(10) = 2, f(000) = 0$$$ an...
1,700
false
false
false
false
false
false
true
true
false
false
4,588
1808E3
This is the hard version of the problem. The only difference between the three versions is the constraints on $$$n$$$ and $$$k$$$. You can make hacks only if all versions of the problem are solved. Maxim is a minibus driver on Venus. To ride on Maxim's minibus, you need a ticket. Each ticket has a number consisting of ...
2,800
true
false
false
true
false
false
true
false
false
false
1,421
552A
Vanya has a table consisting of 100 rows, each row contains 100 cells. The rows are numbered by integers from 1 to 100 from bottom to top, the columns are numbered from 1 to 100 from left to right. In this table, Vanya chose _n_ rectangles with sides that go along borders of squares (some rectangles probably occur mult...
1,000
true
false
true
false
false
false
false
false
false
false
7,627
571E
Problem - 571E - 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,200
true
false
false
false
false
false
false
false
false
false
7,562
263C
One day Vasya came up to the blackboard and wrote out _n_ distinct integers from 1 to _n_ in some order in a circle. Then he drew arcs to join the pairs of integers (_a_,u2009_b_) (_a_u2009≠u2009_b_), that are either each other's immediate neighbors in the circle, or there is number _c_, such that _a_ and _с_ are immed...
2,000
false
false
true
false
false
false
true
false
false
false
8,781
755B
PolandBall is playing a game with EnemyBall. The rules are simple. Players have to say words in turns. You cannot say a word which was already said. PolandBall starts. The Ball which can't say a new word loses. You're given two lists of words familiar to PolandBall and EnemyBall. Can you determine who wins the game, if...
1,100
false
true
false
false
true
false
false
true
true
false
6,776
5A
Polycarp is working on a new project called "Polychat". Following modern tendencies in IT, he decided, that this project should contain chat as well. To achieve this goal, Polycarp has spent several hours in front of his laptop and implemented a chat server that can process three types of commands: Include a person to...
1,000
false
false
true
false
false
false
false
false
false
false
9,970
587E
Duff is the queen of her country, Andarz Gu. She's a competitive programming fan. That's why, when he saw her minister, Malek, free, she gave her a sequence consisting of _n_ non-negative integers, _a_1,u2009_a_2,u2009...,u2009_a__n_ and asked him to perform _q_ queries for her on this sequence. There are two types of ...
2,900
false
false
false
false
true
false
false
false
false
false
7,493
1166F
In a magical land there are $$$n$$$ cities conveniently numbered $$$1, 2, dots, n$$$. Some pairs of these cities are connected by magical colored roads. Magic is unstable, so at any time, new roads may appear between two cities. Vicky the witch has been tasked with performing deliveries between some pairs of cities. Ho...
2,400
false
false
false
false
true
false
false
false
false
true
4,884
1137B
The new camp by widely-known over the country Spring Programming Camp is going to start soon. Hence, all the team of friendly curators and teachers started composing the camp's schedule. After some continuous discussion, they came up with a schedule $$$s$$$, which can be represented as a binary string, in which the $$$...
1,600
false
true
false
false
false
false
false
false
false
false
5,041
553B
Let's define the permutation of length _n_ as an array _p_u2009=u2009[_p_1,u2009_p_2,u2009...,u2009_p__n_] consisting of _n_ distinct integers from range from 1 to _n_. We say that this permutation maps value 1 into the value _p_1, value 2 into the value _p_2 and so on. Kyota Ootori has just learned about cyclic repres...
1,900
true
true
true
false
false
true
false
true
false
false
7,621
1825A
LuoTianyi gives you a palindrome$$$^{dagger}$$$ string $$$s$$$, and she wants you to find out the length of the longest non-empty subsequence$$$^{ddagger}$$$ of $$$s$$$ which is not a palindrome string. If there is no such subsequence, output $$$-1$$$ instead. $$$^{dagger}$$$ A palindrome is a string that reads the sam...
800
false
true
false
false
false
false
false
false
false
false
1,331
1418C
You and your friend are playing the game Mortal Kombat XI. You are trying to pass a challenge tower. There are n bosses in this tower, numbered from 1 to n. The type of the i-th boss is ai. If the i-th boss is easy then its type is ai=0, otherwise this boss is hard and its type is ai=1. During one session, either you o...
1,500
false
true
false
true
false
false
false
false
false
true
3,592
1534C
When he's not training for IOI, Little Alawn enjoys playing with puzzles of various types to stimulate his brain. Today, he's playing with a puzzle that consists of a $$$2 imes n$$$ grid where each row is a permutation of the numbers $$$1,2,3,ldots,n$$$. The goal of Little Alawn's puzzle is to make sure no numbers on ...
1,300
true
false
false
true
false
false
false
false
false
true
2,981
1119H
You have received your birthday gifts — $$$n$$$ triples of integers! The $$$i$$$-th of them is $$$lbrace a_{i}, b_{i}, c_{i} brace$$$. All numbers are greater than or equal to $$$0$$$, and strictly smaller than $$$2^{k}$$$, where $$$k$$$ is a fixed integer. One day, you felt tired playing with triples. So you came up ...
3,200
true
false
false
false
false
false
false
false
false
false
5,087
677D
Vanya is in the palace that can be represented as a grid _n_u2009×u2009_m_. Each room contains a single chest, an the room located in the _i_-th row and _j_-th columns contains the chest of type _a__ij_. Each chest of type _x_u2009≤u2009_p_u2009-u20091 contains a key that can open any chest of type _x_u2009+u20091, and...
2,300
false
false
false
true
true
false
false
false
false
true
7,118
1092A
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 'b' and so on) and there are no other lette...
800
false
false
true
false
false
false
false
false
false
false
5,251
293C
Yaroslav, Andrey and Roman love playing cubes. Sometimes they get together and play cubes for hours and hours! Today they got together again and they are playing cubes. Yaroslav took unit cubes and composed them into an _a_u2009×u2009_a_u2009×u2009_a_ cube, Andrey made a _b_u2009×u2009_b_u2009×u2009_b_ cube and Roman m...
2,400
true
false
false
false
false
false
true
false
false
false
8,659
152E
Vasya has a very beautiful country garden that can be represented as an _n_u2009×u2009_m_ rectangular field divided into _n_·_m_ squares. One beautiful day Vasya remembered that he needs to pave roads between _k_ important squares that contain buildings. To pave a road, he can cover some squares of his garden with conc...
2,500
false
false
false
true
false
false
false
false
false
true
9,265
1854F
Mark loves to move fast. So he made a spaceship that works in $$$4$$$-dimensional space. He wants to use the spaceship to complete missions as fast as possible. In each mission, the spaceship starts at $$$(0, 0, 0, 0)$$$ and needs to end up at $$$(a, b, c, d)$$$. To do this, he instructs the spaceship's computer to exe...
3,500
false
false
false
true
false
false
true
false
false
false
1,153
1201B
Problem - 1201B - 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 - ...
1,500
true
true
false
false
false
false
false
false
false
false
4,694
1912B
An aircraft manufacturing company wants to optimize their products for passenger airlines. The company's latest research shows that most of the delays happen because of slow boarding. Most of the medium-sized aircraft are designed with 3-3 seat layout, meaning each row has 6 seats: 3 seats on the left side, a single ai...
2,100
true
false
false
false
false
false
false
false
false
false
836
1999G2
Enter Register HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP RAYAN Codeforces Round 964 (Div. 4) 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...
1,700
false
false
false
false
false
false
false
true
false
false
264
487A
A monster is attacking the Cyberland! Master Yang, a braver, is going to beat the monster. Yang and the monster each have 3 attributes: hitpoints (_HP_), offensive power (_ATK_) and defensive power (_DEF_). During the battle, every second the monster's HP decrease by _max_(0,u2009_ATK__Y_u2009-u2009_DEF__M_), while Yan...
1,800
false
false
true
false
false
false
true
true
false
false
7,890
1407D
There are $$$n$$$ beautiful skyscrapers in New York, the height of the $$$i$$$-th one is $$$h_i$$$. Today some villains have set on fire first $$$n - 1$$$ of them, and now the only safety building is $$$n$$$-th skyscraper. Let's call a jump from $$$i$$$-th skyscraper to $$$j$$$-th ($$$i < j$$$) discrete, if all skyscra...
2,200
false
false
false
true
true
false
false
false
false
true
3,638
1065D
You stumbled upon a new kind of chess puzzles. The chessboard you are given is not necesserily $$$8 imes 8$$$, but it still is $$$N imes N$$$. Each square has some number written on it, all the numbers are from $$$1$$$ to $$$N^2$$$ and all the numbers are pairwise distinct. The $$$j$$$-th square in the $$$i$$$-th row...
2,200
false
false
false
true
false
false
false
false
false
false
5,385
1163E
Kuro has just learned about permutations and he is really excited to create a new permutation type. He has chosen $$$n$$$ distinct positive integers and put all of them in a set $$$S$$$. Now he defines a magical permutation to be: A permutation of integers from $$$0$$$ to $$$2^x - 1$$$, where $$$x$$$ is a non-negative...
2,400
true
false
false
false
true
true
true
false
false
true
4,898
915G
Problem - 915G - 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,300
true
false
false
false
false
false
false
false
false
false
6,069
283D
Problem - 283D - 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,400
true
false
false
true
false
false
false
false
false
false
8,700
1919D
There is an edge-weighted complete binary tree with $$$n$$$ leaves. A complete binary tree is defined as a tree where every non-leaf vertex has exactly 2 children. For each non-leaf vertex, we label one of its children as the left child and the other as the right child. The binary tree has a very strange property. For ...
2,100
false
true
false
false
true
true
false
false
true
false
778
28D
A motorcade of _n_ trucks, driving from city «Z» to city «З», has approached a tunnel, known as Tunnel of Horror. Among truck drivers there were rumours about monster DravDe, who hunts for drivers in that tunnel. Some drivers fear to go first, others - to be the last, but let's consider the general case. Each truck is ...
2,400
false
false
false
true
true
false
false
true
false
false
9,855
1687C
Is it really?! The robot only existing in my imagination?! The Colossal Walking Robot?!! — Kochiya Sanae Sanae made a giant robot — Hisoutensoku, but something is wrong with it. To make matters worse, Sanae can not figure out how to stop it, and she is forced to fix it on-the-fly. The state of a robot can be represente...
2,500
false
true
false
false
true
false
true
true
true
false
2,155
811B
Vladik had started reading a complicated book about algorithms containing _n_ pages. To improve understanding of what is written, his friends advised him to read pages in some order given by permutation _P_u2009=u2009[_p_1,u2009_p_2,u2009...,u2009_p__n_], where _p__i_ denotes the number of page that should be read _i_-...
1,200
false
false
true
false
false
false
false
false
true
false
6,520
659E
Berland has _n_ cities connected by _m_ bidirectional roads. No road connects a city to itself, and each pair of cities is connected by no more than one road. It is not guaranteed that you can get from any city to any other one, using only the existing roads. The President of Berland decided to make changes to the road...
1,600
false
true
false
false
true
false
false
false
false
true
7,185
485B
Problem - 485B - 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
false
true
false
false
false
false
true
false
false
false
7,896
1238E
You have a password which you often type — a string $$$s$$$ of length $$$n$$$. Every character of this string is one of the first $$$m$$$ lowercase Latin letters. Since you spend a lot of time typing it, you want to buy a new keyboard. A keyboard is a permutation of the first $$$m$$$ Latin letters. For example, if $$$m...
2,200
false
false
false
true
false
false
false
false
false
false
4,499
1101C
There are $$$n$$$ segments $$$[l_i, r_i]$$$ for $$$1 le i le n$$$. You should divide all segments into two non-empty groups in such way that there is no pair of segments from different groups which have at least one common point, or say that it's impossible to do it. Each segment should belong to exactly one group. To ...
1,500
false
false
false
false
false
false
false
false
true
false
5,198
106B
Vasya is choosing a laptop. The shop has _n_ laptops to all tastes. Vasya is interested in the following properties: processor speed, ram and hdd. Vasya is a programmer and not a gamer which is why he is not interested in all other properties. If all three properties of a laptop are strictly less than those properties ...
1,000
false
false
true
false
false
false
true
false
false
false
9,460
514B
There are _n_ Imperial stormtroopers on the field. The battle field is a plane with Cartesian coordinate system. Each stormtrooper is associated with his coordinates (_x_,u2009_y_) on this plane. Han Solo has the newest duplex lazer gun to fight these stormtroopers. It is situated at the point (_x_0,u2009_y_0). In one ...
1,400
true
false
true
false
true
false
true
false
false
false
7,779
499B
You have a new professor of graph theory and he speaks very quickly. You come up with the following plan to keep up with his lecture and make notes. You know two languages, and the professor is giving the lecture in the first one. The words in both languages consist of lowercase English characters, each language consis...
1,000
false
false
true
false
false
false
false
false
false
false
7,838
1788C
You are given an integer $$$n$$$. Pair the integers $$$1$$$ to $$$2n$$$ (i.e. each integer should be in exactly one pair) so that each sum of matched pairs is consecutive and distinct. Formally, let $$$(a_i, b_i)$$$ be the pairs that you matched. $$${a_1, b_1, a_2, b_2, ldots, a_n, b_n}$$$ should be a permutation of $$...
1,300
true
true
false
false
false
true
false
false
false
false
1,552
813A
Pasha is participating in a contest on one well-known website. This time he wants to win the contest and will do anything to get to the first place! This contest consists of _n_ problems, and Pasha solves _i_th problem in _a__i_ time units (his solutions are always correct). At any moment of time he can be thinking abo...
1,100
false
false
true
false
false
false
false
false
false
false
6,511
1696C
Fishingprince is playing with an array $$$[a_1,a_2,dots,a_n]$$$. He also has a magic number $$$m$$$. He can do the following two operations on it: Select $$$1le ile n$$$ such that $$$a_i$$$ is divisible by $$$m$$$ (that is, there exists an integer $$$t$$$ such that $$$m cdot t = a_i$$$). Replace $$$a_i$$$ with $$$m$$$...
1,400
true
true
true
false
false
true
false
false
false
false
2,106
223D
A plane contains a not necessarily convex polygon without self-intersections, consisting of _n_ vertexes, numbered from 1 to _n_. There is a spider sitting on the border of the polygon, the spider can move like that: 1. Transfer. The spider moves from the point _p_1 with coordinates (_x_1,u2009_y_1), lying on the polyg...
3,000
false
false
false
false
false
false
false
false
false
true
8,944
1978C
Let's call the Manhattan value of a permutation$$$^{dagger}$$$ $$$p$$$ the value of the expression $$$p_1 - 1 + p_2 - 2 + ldots + p_n - n$$$. For example, for the permutation $$$[1, 2, 3]$$$, the Manhattan value is $$$1 - 1 + 2 - 2 + 3 - 3 = 0$$$, and for the permutation $$$[3, 1, 2]$$$, the Manhattan value is $$$3 - 1...
1,300
true
true
true
false
true
true
false
false
false
false
420
1981C
Turtle was playing with a sequence $$$a_1, a_2, ldots, a_n$$$ consisting of positive integers. Unfortunately, some of the integers went missing while playing. Now the sequence becomes incomplete. There may exist an arbitrary number of indices $$$i$$$ such that $$$a_i$$$ becomes $$$-1$$$. Let the new sequence be $$$a'$$...
1,800
true
true
true
false
false
true
true
false
false
false
400
105B
Dark Assembly is a governing body in the Netherworld. Here sit the senators who take the most important decisions for the player. For example, to expand the range of the shop or to improve certain characteristics of the character the Dark Assembly's approval is needed. The Dark Assembly consists of _n_ senators. Each o...
1,800
false
false
false
false
false
false
true
false
false
false
9,465
1762G
You are given an array $$$a$$$ consisting of $$$n$$$ positive integers. Find any permutation $$$p$$$ of $$$[1,2,dots,n]$$$ such that: $$$p_{i-2} < p_i$$$ for all $$$i$$$, where $$$3 leq i leq n$$$, and $$$a_{p_{i-1}} eq a_{p_i}$$$ for all $$$i$$$, where $$$2 leq i leq n$$$. Or report that no such permutation exists....
3,100
false
false
false
false
false
true
false
false
true
false
1,734
87B
Programmer Vasya is studying a new programming language &K*. The &Klanguage resembles the languages of the C family in its syntax. However, it is more powerful, which is why the rules of the actual C-like languages are unapplicable to it. To fully understand the statement, please read the language's description below c...
1,800
false
false
true
false
false
false
false
false
false
false
9,535
1106D
Lunar New Year is approaching, and Bob decides to take a wander in a nearby park. The park can be represented as a connected graph with $$$n$$$ nodes and $$$m$$$ bidirectional edges. Initially Bob is at the node $$$1$$$ and he records $$$1$$$ on his notebook. He can wander from one node to another through those bidirec...
1,500
false
true
false
false
true
false
false
false
false
true
5,172
113C
Problem - 113C - 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
true
false
false
false
false
false
true
false
false
false
9,433
559E
The main walking trail in Geraldion is absolutely straight, and it passes strictly from the north to the south, it is so long that no one has ever reached its ends in either of the two directions. The Geraldionians love to walk on this path at any time, so the mayor of the city asked the Herald to illuminate this path ...
3,000
false
false
false
true
false
false
false
false
true
false
7,594
1299C
There are $$$n$$$ water tanks in a row, $$$i$$$-th of them contains $$$a_i$$$ liters of water. The tanks are numbered from $$$1$$$ to $$$n$$$ from left to right. You can perform the following operation: choose some subsegment $$$[l, r]$$$ ($$$1le l le r le n$$$), and redistribute water in tanks $$$l, l+1, dots, r$$$ ev...
2,100
false
true
false
false
true
false
false
false
false
false
4,199
1245A
Consider the set of all nonnegative integers: $$${0, 1, 2, dots}$$$. Given two integers $$$a$$$ and $$$b$$$ ($$$1 le a, b le 10^4$$$). We paint all the numbers in increasing number first we paint $$$0$$$, then we paint $$$1$$$, then $$$2$$$ and so on. Each number is painted white or black. We paint a number $$$i$$$ acc...
1,000
true
false
false
false
false
false
false
false
false
false
4,474
430A
Iahub isn't well prepared on geometry problems, but he heard that this year there will be a lot of geometry problems on the IOI selection camp. Scared, Iahub locked himself in the basement and started thinking of new problems of this kind. One of them is the following. Iahub wants to draw _n_ distinct points and _m_ se...
1,600
false
false
false
false
false
true
false
false
true
false
8,121
157A
Sherlock Holmes and Dr. Watson played some game on a checkered board _n_u2009×u2009_n_ in size. During the game they put numbers on the board's squares by some tricky rules we don't know. However, the game is now over and each square of the board contains exactly one number. To understand who has won, they need to coun...
800
false
false
false
false
false
false
true
false
false
false
9,247
1659F
There is a tree of $$$n$$$ vertices and a permutation $$$p$$$ of size $$$n$$$. A token is present on vertex $$$x$$$ of the tree. Alice and Bob are playing a game. Alice is in control of the permutation $$$p$$$, and Bob is in control of the token on the tree. In Alice's turn, she must pick two distinct numbers $$$u$$$ a...
3,000
false
false
false
false
false
false
false
false
false
true
2,327
1864H
Bogocubic is playing a game with amenotiomoi. First, Bogocubic fixed an integer $$$n$$$, and then he gave amenotiomoi an integer $$$x$$$ which is initially equal to $$$1$$$. In one move amenotiomoi performs one of the following operations with the same probability: increase $$$x$$$ by $$$1$$$; multiply $$$x$$$ by $$$...
3,200
true
false
false
true
false
false
false
false
false
false
1,090
1030C
Problem - 1030C - Codeforces =============== xa0 ]( "Технокубок 2019 — Отборочный Раунд 1 (и открытые рейтинговые раунды Codeforces Round 512 Div.1, Div.2)") Editorial") — the number of digits in the ticket. The second line contains $$$n$$$ digits $$$a_1 a_2 dots a_n$$$ ($$$0 le a_i le 9$$$) — the golden ...
1,300
false
false
true
false
false
false
false
false
false
false
5,553
437D
Of course our child likes walking in a zoo. The zoo has _n_ areas, that are numbered from 1 to _n_. The _i_-th area contains _a__i_ animals in it. Also there are _m_ roads in the zoo, and each road connects two distinct areas. Naturally the zoo is connected, so you can reach any area of the zoo from any other area usin...
1,900
false
false
false
false
false
false
false
false
true
false
8,088
440B
Problem - 440B - Codeforces =============== xa0 . The second line contains _n_ non-negative numbers that do not exceed 109, the _i_-th written number is the number of matches in the _i_-th matchbox. It is guaranteed that the total number of matches is divisible by _n_. Output Print the total minimum number of...
1,600
false
true
true
false
false
false
false
false
false
false
8,078
1520A
Polycarp has $$$26$$$ tasks. Each task is designated by a capital letter of the Latin alphabet. The teacher asked Polycarp to solve tasks in the following way: if Polycarp began to solve some task, then he must solve it to the end, without being distracted by another task. After switching to another task, Polycarp cann...
800
false
false
true
false
false
false
true
false
false
false
3,063
2041B
Bowling is a national sport in Taiwan; everyone in the country plays the sport on a daily basis since their youth. Naturally, there are a lot of bowling alleys all over the country, and the competition between them is as intense as you can imagine. Maw-Shang owns one such bowling alley. To stand out from other competit...
1,200
true
false
false
false
false
false
true
true
false
false
12
1725D
Let's say Pak Chanek has an array $$$A$$$ consisting of $$$N$$$ positive integers. Pak Chanek will do a number of operations. In each operation, Pak Chanek will do the following: 1. Choose an index $$$p$$$ ($$$1 leq p leq N$$$). 2. Let $$$c$$$ be the number of operations that have been done on index $$$p$$$ before this...
2,900
true
false
false
false
false
false
false
true
false
false
1,943
1102A
Problem - 1102A - 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
false
false
false
false
false
false
false
false
false
5,193
1999B
Suneet and Slavic play a card game. The rules of the game are as follows: Each card has an integer value between $$$1$$$ and $$$10$$$. Each player receives $$$2$$$ cards which are face-down (so a player doesn't know their cards). The game is turn-based and consists exactly of two turns. In a round, both players pick...
1,000
false
false
true
false
false
true
true
false
false
false
270
547A
Mike has a frog and a flower. His frog is named Xaniar and his flower is named Abol. Initially(at time 0), height of Xaniar is _h_1 and height of Abol is _h_2. Each second, Mike waters Abol and Xaniar. So, if height of Xaniar is _h_1 and height of Abol is _h_2, after one second height of Xaniar will become and height o...
2,200
true
true
true
false
false
false
true
false
false
false
7,652
883E
Polycarpus takes part in the "Field of Wonders" TV show. The participants of the show have to guess a hidden word as fast as possible. Initially all the letters of the word are hidden. The game consists of several turns. At each turn the participant tells a letter and the TV show host responds if there is such letter i...
1,500
false
false
true
false
false
false
false
false
false
false
6,223
1427A
You are given an array of $$$n$$$ integers $$$a_1,a_2,dots,a_n$$$. You have to create an array of $$$n$$$ integers $$$b_1,b_2,dots,b_n$$$ such that: The array $$$b$$$ is a rearrangement of the array $$$a$$$, that is, it contains the same values and each value appears the same number of times in the two arrays. In othe...
900
true
false
false
false
false
false
false
false
true
false
3,533
344A
Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two magnets are put together at a close distance, then the like poles will repel each other and the oppo...
800
false
false
true
false
false
false
false
false
false
false
8,458
1769D1
В этой версии задачи нужно определить, кто выиграет в карточной игре для двух игроков в заданном раскладе при оптимальной игре обоих соперников. Алиса и Боб решили сыграть в карточную игру «Девятка». Пожалуйста, внимательно прочитайте условие задачи, поскольку правила могут отличаться от известных вам. Для игры нужна с...
1,800
false
false
false
true
false
false
true
false
false
false
1,680
1882A
You are given a sequence $$$a_{1}, a_{2}, ldots, a_{n}$$$. A sequence $$$b_{1}, b_{2}, ldots, b_{n}$$$ is called good, if it satisfies all of the following conditions: $$$b_{i}$$$ is a positive integer for $$$i = 1, 2, ldots, n$$$; $$$b_{i} eq a_{i}$$$ for $$$i = 1, 2, ldots, n$$$; $$$b_{1} < b_{2} < ldots < b_{n}$...
800
false
true
false
false
false
false
false
false
false
false
997
1539C
There are $$$n$$$ students numerated from $$$1$$$ to $$$n$$$. The level of the $$$i$$$-th student is $$$a_i$$$. 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 $$$x$$$. For example, if $$$x = ...
1,200
false
true
false
false
false
false
false
false
true
false
2,946
295D
Greg has a pad. The pad's screen is an _n_u2009×u2009_m_ rectangle, each cell can be either black or white. We'll consider the pad rows to be numbered with integers from 1 to _n_ from top to bottom. Similarly, the pad's columns are numbered with integers from 1 to _m_ from left to right. Greg thinks that the pad's scre...
2,400
false
false
false
true
false
false
false
false
false
false
8,648
776G
Sherlock found a piece of encrypted data which he thinks will be useful to catch Moriarty. The encrypted data consists of two integer _l_ and _r_. He noticed that these integers were in hexadecimal form. He takes each of the integers from _l_ to _r_, and performs the following operations: 1. He lists the distinct digit...
2,900
false
false
false
true
false
false
false
false
false
false
6,662
983E
In the NN country, there are $$$n$$$ cities, numbered from $$$1$$$ to $$$n$$$, and $$$n - 1$$$ roads, connecting them. There is a roads path between any two cities. There are $$$m$$$ bidirectional bus routes between cities. Buses drive between two cities taking the shortest path with stops in every city they drive thro...
2,800
false
false
false
false
true
false
false
true
false
false
5,782
466B
Problem - 466B - 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
false
false
true
false
false
false
7,976
524C
ATMs of a well-known bank of a small country are arranged so that they can not give any amount of money requested by the user. Due to the limited size of the bill dispenser (the device that is directly giving money from an ATM) and some peculiarities of the ATM structure, you can get at most _k_ bills from it, and the ...
1,900
false
false
false
false
false
false
false
true
true
false
7,740
801B
You found a mysterious function _f_. The function takes two strings _s_1 and _s_2. These strings must consist only of lowercase English letters, and must be the same length. The output of the function _f_ is another string of the same length. The _i_-th character of the output is equal to the minimum of the _i_-th char...
900
false
true
false
false
false
true
false
false
false
false
6,568
1335C
You have $$$n$$$ students under your control and you have to compose exactly two teams consisting of some subset of your students. Each student had his own skill, the $$$i$$$-th student skill is denoted by an integer $$$a_i$$$ (different students can have the same skills). So, about the teams. Firstly, these two teams ...
1,100
false
true
true
false
false
false
false
true
true
false
4,028
1096F
A permutation of size $$$n$$$ is an array of size $$$n$$$ such that each integer from $$$1$$$ to $$$n$$$ occurs exactly once in this array. An inversion in a permutation $$$p$$$ is a pair of indices $$$(i, j)$$$ such that $$$i > j$$$ and $$$a_i < a_j$$$. For example, a permutation $$$[4, 1, 3, 2]$$$ contains $$$4$$$ in...
2,300
true
false
false
true
false
false
false
false
false
false
5,226
1067E
Problem - 1067E - Codeforces =============== xa0 ]( "Announcement") . Input First line of input contains $$$n$$$ ($$$1 le n le 5 cdot 10^{5}$$$)xa0— number of vertices. Next $$$n-1$$$ lines contains two integers $$$u$$$ $$$v$$$ ($$$1 le u, ,, v le n; ,, u e v$$$)xa0— indices of vertices connected by edge...
2,800
true
false
false
true
false
false
false
false
false
false
5,371