A. Sereja and Swaps time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output As usual, Sereja has array a, its elements are integers: a[1], a[2], ..., a[n]. Let's introduce notation: A swap operatio…
[codeforces 339]E. Three Swaps 试题描述 Xenia the horse breeder has n (n > 1) horses that stand in a row. Each horse has its own unique number. Initially, the i-th left horse has number i. That is, the sequence of numbers of horses in a row looks as foll…
Steady Cow Assignment Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status Practice POJ 3189 Description Farmer John's N (1 <= N <= 1000) cows each reside in one of B (1 <= B <= 20) barns which, of co…
A. Bear and Big Brother time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Bear Limak wants to become the largest of bears, or at least to become larger than his brother Bob. Right now, Limak…
题目链接:https://codeforces.com/contest/1090/problem/B Examplesstandard input The most famous characters of Pushkin’s works are Onegin \cite{onegin}, Dubrovsky \cite{dubrovsky} and Tsar Saltan \cite{saltan}. \begin{thebibliography}{99} \bibitem{saltan} A…
Codeforces 1082B Vova and Trophies https://vjudge.net/problem/CodeForces-1082B 题目: Vova has won nn trophies in different competitions. Each trophy is either golden or silver. The trophies are arranged in a row. The beauty of the arrangement is the le…
D. Swaps in Permutation 题目连接: http://www.codeforces.com/contest/691/problem/D Description You are given a permutation of the numbers 1, 2, ..., n and m pairs of positions (aj, bj). At each step you can choose a pair from the given positions and swap…
Zane the wizard is going to perform a magic show shuffling the cups. There are n cups, numbered from 1 to n, placed along the x-axis on a table that has m holes on it. More precisely, cup i is on the table at the position x = i. The problematic bone…
A bracket sequence is a string, containing only characters "(", ")", "[" and "]". A correct bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters…