Codeforces Round 648 (Div. 2)


A. Matrix Game
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
2 2
0 0
0 0
2 2
0 0
0 1
2 3
1 0 1
1 1 0
3 3
1 0 0
0 0 0
1 0 0
Output
Vivek
Ashish
Vivek
Ashish
----------------------------------------------------------------------------------------------------
B. Trouble Sort
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
4
10 20 20 30
0 1 0 1
3
3 1 2
0 1 1
4
2 2 4 8
1 1 1 1
3
5 15 4
0 0 0
4
20 10 100 50
1 0 0 1
Output
Yes
Yes
Yes
No
Yes
----------------------------------------------------------------------------------------------------
C. Rotation Matching
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 2 3 4 5
2 3 4 5 1
Output
5
Input
5
5 4 3 2 1
1 2 3 4 5
Output
1
Input
4
1 3 2 4
4 2 3 1
Output
2
----------------------------------------------------------------------------------------------------
D. Solve The Maze
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
1 1
.
1 2
G.
2 2
#B
G.
2 3
G.#
B#.
3 3
#B.
#..
GG.
2 2
#B
B.
Output
Yes
Yes
No
No
Yes
Yes
----------------------------------------------------------------------------------------------------
E. Maximum Subsequence Value
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
2 1 3
Output
3
Input
3
3 1 4
Output
7
Input
1
1
Output
1
Input
4
7 7 1 1
Output
7
----------------------------------------------------------------------------------------------------
F. Swaps Again
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
2
1 2
2 1
3
1 2 3
1 2 3
3
1 2 4
1 3 4
4
1 2 3 2
3 1 2 2
3
1 2 3
1 3 2
Output
yes
yes
No
yes
No
----------------------------------------------------------------------------------------------------
G. Secure Password
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1
2
4
Output
? 1 1
? 1 2
? 1 3
! 6 5 3
----------------------------------------------------------------------------------------------------
