题目链接:http://codeforces.com/contest/745/problem/C C. Hongcow Builds A Nation time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Hongcow is ruler of the world. As ruler of the world, he wants t…
大意: 给定括号字符串, 求多少个子序列是RSGS. RSGS定义如下: It is not empty (that is n ≠ 0). The length of the sequence is even. First $\frac{n}{2}$ charactes of the sequence are equal to "(". Last $\frac{n}{2}$ charactes of the sequence are equal to ")". 枚举…
You are given an array a of length n. We define fa the following way: Initially fa = 0, M = 1; for every 2 ≤ i ≤ n if aM < ai then we set fa = fa + aM and then set M = i. Calculate the sum of fa over all n! permutations of the array a modulo 109 + 7.…
Description Given an undirected graph, in which two vertices can be connected by multiple edges, what is the size of the minimum cut of the graph? i.e. how many edges must be removed at least to disconnect the graph into two subgraphs? Input Input co…
C. Alyona and the Tree 题目连接: http://www.codeforces.com/contest/682/problem/C Description Alyona decided to go on a diet and went to the forest to get some apples. There she unexpectedly found a magic rooted tree with root in the vertex 1, every verte…
Make It Connected CodeForces - 1095F You are given an undirected graph consisting of nn vertices. A number is written on each vertex; the number on vertex ii is aiai. Initially there are no edges in the graph. You may add some edges to this graph, bu…
Alyona and the Tree 题目链接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/C Description Alyona decided to go on a diet and went to the forest to get some apples. There she unexpectedly found a magic rooted tree with root in the vertex 1, every v…
A. Alyona and Numbers time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output After finishing eating her bun, Alyona came up with two integers n and m. She decided to write down two columns of inte…
C. Alyona and the Tree time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Alyona decided to go on a diet and went to the forest to get some apples. There she unexpectedly found a magic rooted…
Alyona decided to go on a diet and went to the forest to get some apples. There she unexpectedly found a magic rooted tree with root in the vertex 1, every vertex and every edge of which has a number written on. The girl noticed that some of the tree…
A. Minimizing the String time limit per test 1 second memory limit per test 256 megabytes Description: You are given a string ss consisting of nn lowercase Latin letters. You have to remove at most one (i.e. zero or one) character of this string in s…