School Personal Contest #2 (Winter Computer School 2010/11) - Codeforces Beta Round 43 (ACM-ICPC Rules)


A. Ball Game
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
10
Output
2 4 7 1 6 2 9 7 6
Input
3
Output
2 1
----------------------------------------------------------------------------------------------------
B. T-shirts from Sponsor
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 0 2 0 1
3
XL
XXL
M
Output
XXL
L
L
----------------------------------------------------------------------------------------------------
C. Hamsters and Tigers
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
HTH
Output
0
Input
9
HTHTHTHHT
Output
2
----------------------------------------------------------------------------------------------------
D. Parking Lot
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
30 1 2
6
1 5
1 4
1 5
2 2
1 5
1 4
Output
0
6
11
17
23
Input
30 1 1
6
1 5
1 4
1 5
2 2
1 5
1 4
Output
0
6
11
17
6
Input
10 1 1
1
1 12
Output
-1
----------------------------------------------------------------------------------------------------
E. Comb
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
-1 2
1 3
Output
2
----------------------------------------------------------------------------------------------------
F. Hercule Poirot Problem
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 1 2
1 2
Dmitry 1 1 1
Natalia 2 0
Natalia 1 1 1
Dmitry 2 0
Output
YES
Input
4 4 3
1 3
1 2
2 3
3 4
Artem 1 1 4
Dmitry 1 1 2
Edvard 4 2 1 3
Artem 2 0
Dmitry 1 0
Edvard 4 4 1 2 3 4
Output
NO
----------------------------------------------------------------------------------------------------
G. Emperor's Problem
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
Output
YES
0 0
1 0
0 2
Input
3
Output
YES
0 1
-1 0
-1 -1
----------------------------------------------------------------------------------------------------
