Codeforces Round 812 (Div. 2)


A. Traveling Salesman Problem
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
4
0 -2
1 0
-1 0
0 2
3
0 2
-3 0
0 -1
1
0 0
Output
12
12
0
----------------------------------------------------------------------------------------------------
B. Optimal Reduction
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
4
2 3 5 4
3
1 2 3
4
3 1 3 2
Output
YES
YES
NO
----------------------------------------------------------------------------------------------------
C. Build Permutation
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3
4
7
Output
1 0 2 
0 3 2 1 
1 0 2 6 5 4 3 
----------------------------------------------------------------------------------------------------
D. Tournament Countdown
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
3
2
0
2
Output
? 1 4
? 1 6
? 5 7
! 7
----------------------------------------------------------------------------------------------------
E. Cross Swapping
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
3
2 1 2
2 1 2
1 1 2
4
3 3 1 2
1 1 3 1
3 2 3 2
2 3 3 1
Output
2 1 1
2 1 1
2 2 2
3 1 1 2
3 1 2 1
3 3 3 3
2 3 2 1
----------------------------------------------------------------------------------------------------
F. Lost Array
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
0 2 1
Output
1 2 3 
Input
1
199633
Output
199633 
Input
10
346484077 532933626 858787727 369947090 299437981 416813461 865836801 141384800 157794568 691345607
Output
725081944 922153789 481174947 427448285 516570428 509717938 855104873 280317429 281091129 1050390365 
----------------------------------------------------------------------------------------------------
