Codeforces Round 865 (Div. 1)


A. Ian and Array Sorting
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
3
1 3 2
2
2 1
4
1 3 5 7
4
2 1 4 3
5
5 4 3 2 1
Output
YES
NO
YES
NO
YES
----------------------------------------------------------------------------------------------------
B. Sum Graph
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
6
1
1
1
1
1
2
-1
1
2
1
Output
+ 12
+ 2
+ 3
? 1 3
+ 5
? 1 5
? 4 5
! 1 4 2 5 3 6 1 2 3 4 5 6
! 1 2 2 1
----------------------------------------------------------------------------------------------------
C. Between
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
3 2
3 1
2 1
1 0
2 0
2 2
1 2
2 1
5 5
2 1
3 1
4 2
4 5
5 1
Output
FINITE
5
2 3 1 2 3 
FINITE
1
1 
INFINITE
FINITE
3
2 1 2 
FINITE
10
4 2 3 5 4 1 3 2 5 4 
----------------------------------------------------------------------------------------------------
D. XOR Counting
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
69 1
5 2
0 10
420 69
12 26
73 34
1000000000000000000 10
Output
69
6
0
44310
42
1369
216734648
----------------------------------------------------------------------------------------------------
E. Bosco and Particle
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
00
Output
4
Input
2
01
010
Output
16
Input
4
0101
000
1
01
Output
12
Input
4
01010
0001
11
0001
Output
120
----------------------------------------------------------------------------------------------------
F. OH NO1 (-2-3-4)
time limit per test: 4 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
4
4 1
0 0 0 0
1 2 3
5 2
0 0 0 0 0
1 2 3
1 4 5
4 4
3 4 5 6
1 2 3
1 2 4
1 3 4
2 3 4
5 4
0 1000000 412 412 412
1 2 3
1 4 5
2 4 5
3 4 5
Output
2 1 3
2 3 3
4 3 3
3 1 2
2 2 3
2 3 4
3 1 1
2 3 4
1 2 4
4 4 3
4 1 1
----------------------------------------------------------------------------------------------------
