Berland has n cities, some of them are connected by bidirectional roads. For each road we know whether it is asphalted or not. The King of Berland Valera II wants to asphalt all roads of Berland, for that he gathered a group of workers. Every day Val…
B. Segment Occurrences time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given two strings s and t , both consisting only of lowercase Latin letters. The substring s[l..r] is the str…
E1. Median on Segments (Permutations Edition) time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output You are given a permutation p1,p2,…,pnp1,p2,…,pn. A permutation of length nn is a sequence suc…
A and B and Lecture Rooms time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A and B are preparing themselves for programming contests. The University where A and B study is a set of rooms co…