Codeforces Round 138 (Div. 1)


A. Bracket Sequence
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
([])
Output
1
([])
Input
(((
Output
0
----------------------------------------------------------------------------------------------------
B. Two Strings
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
abab
ab
Output
Yes
Input
abacaba
aba
Output
No
Input
abc
ba
Output
No
----------------------------------------------------------------------------------------------------
C. Partial Sums
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 1
1 2 3
Output
1 3 6
Input
5 0
3 14 15 92 6
Output
3 14 15 92 6
----------------------------------------------------------------------------------------------------
D. Spider
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
0 0
1 0
1 1
0 1
1 4
Output
1.000000000000000000e+000
Input
4
0 0
1 1
0 2
-1 1
3 3
Output
0.000000000000000000e+000
Input
5
0 0
5 0
1 4
0 2
2 1
3 1
Output
5.650281539872884700e+000
----------------------------------------------------------------------------------------------------
E. Planar Graph
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3
1 2
2 3
3 1
0 0
1 0
0 1
1
3 1 2 3
Output
3
Input
5 8
1 2
2 3
3 4
4 1
1 5
2 5
3 5
4 5
0 0
2 0
2 2
0 2
1 1
1
4 1 2 3 4
Output
5
Input
4 5
1 2
2 3
3 4
4 1
2 4
0 0
1 0
1 1
0 1
3
3 1 2 4
3 4 2 3
4 1 2 3 4
Output
3
3
4
----------------------------------------------------------------------------------------------------
