Let's call an array of non-negative integers a1,a2,…,ana1,a2,…,an a kk-extension for some non-negative integer kk if for all possible pairs of indices 1≤i,j≤n1≤...
Recently, on the course of algorithms and data structures, Valeriy learned how to use a deque. He built a deque filled with nn elements. The ii-th element is ai...
B. Nick and Array time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Nick had received an awesome arr...
A. Alex and a Rhombus time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output While playing with geometric...
Treeland consists of n cities and n−1 roads. Each road is bidirectional and connects two distinct cities. From any city you can get to any other city by roads. ...
A superhero fights with a monster. The battle consists of rounds, each of which lasts exactly nn minutes. After a round ends, the next round starts immediately....