
Chat Order
Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when […]
Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when […]
During a New Year special offer the “Sudislavl Bars” offered n promo codes. Each promo code consists of exactly six digits and gives right to one free […]
A sportsman starts from point x start = 0 and runs to point with coordinate x finish = m (on a straight line). Also, the sportsman can jump — to jump, he should first take […]
There are n parliamentarians in Berland. They are numbered with integers from 1 to n. It happened that all parliamentarians with odd indices are Democrats and all parliamentarians with even […]
In this problem you have to simulate the workflow of one-thread server. There are n queries to process, the i-th will be received at moment t i and needs to be […]
There are some websites that are accessible through several different addresses. For example, for a long time MaiXuanViet was accessible with two hostnames maixuanviet.com and maixuanviet.vn. You are […]
It is a balmy spring afternoon, and Farmer John’s n cows are ruminating about link-cut cacti in their stalls. The cows, labeled 1 through n, are arranged so that the i-th […]
Bessie the cow and her best friend Elsie each received a sliding puzzle on Pi Day. Their puzzles consist of a 2 × 2 grid and three tiles labeled […]
In an attempt to escape the Mischievous Mess Makers’ antics, Farmer John has abandoned his farm and is traveling to the other side of Bovinia. […]
While Farmer John rebuilds his farm in an unfamiliar portion of Bovinia, Bessie is out trying some alternative jobs. In her new gig as a […]
After getting kicked out of her reporting job for not knowing the alphabet, Bessie has decided to attend school at the Fillet and Eggs Eater […]
In an attempt to make peace with the Mischievious Mess Makers, Bessie and Farmer John are planning to plant some flower gardens to complement the […]
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 […]
A tree is a connected undirected graph consisting of n vertices and n - 1 edges. Vertices are numbered 1 through n. Limak is a little polar bear and Radewoosh is his evil enemy. […]
Codeforces is a wonderful platform and one its feature shows how much someone contributes to the community. Every registered user has contribution — an integer number, not […]
Limak is a little polar bear. He doesn’t have many toys and thus he often plays with polynomials. He considers a polynomial valid if its degree is n and […]
Limak is a big polar bear. He prepared n problems for an algorithmic contest. The i-th problem has initial score p i. Also, testers said that it takes t i minutes to solve the i-th problem. […]
As you know, the game of “Nim” is played with n piles of stones, where the i-th pile initially contains a i stones. Two players alternate the turns. During a turn […]
You are given an undirected graph that consists of n vertices and m edges. Initially, each edge is colored either red or blue. Each turn a player picks a […]
Consider a regular Codeforces round consisting of three problems that uses dynamic scoring. You are given an almost final scoreboard. For each participant (including yourself), […]