AIM Tech Round 3 (Div. 1)


A. Letters Cyclic Shift
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
codeforces
Output
bncdenqbdr
Input
abacaba
Output
aaacaba
----------------------------------------------------------------------------------------------------
B. Recover the String
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 2 3 4
Output
Impossible
Input
1 2 2 1
Output
0110
----------------------------------------------------------------------------------------------------
C. Centroids
time limit per test: 4 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3
1 2
2 3
Output
1 1 1 
Input
5
1 2
1 3
1 4
1 5
Output
1 0 0 0 0 
----------------------------------------------------------------------------------------------------
D. Incorrect Flow
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 1
1 2 2 1
Output
0
Input
2 1
1 2 1 2
Output
1
Input
3 3
1 2 1 1
2 3 2 2
1 3 3 3
Output
1
Input
4 2
2 3 1 1
3 2 1 1
Output
0
----------------------------------------------------------------------------------------------------
E. Student's Camp
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
1 2
1
Output
937500007
Input
5 1
3 10
1
Output
95964640
Input
3 3
1 10
5
Output
927188454
----------------------------------------------------------------------------------------------------
