Codeforces Round 270


A. Design Tutorial: Learn from Math
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
12
Output
4 8
Input
15
Output
6 9
Input
23
Output
8 15
Input
1000000
Output
500000 500000
----------------------------------------------------------------------------------------------------
B. Design Tutorial: Learn from Life
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
2 3 4
Output
8
Input
4 2
50 100 50 100
Output
296
Input
10 3
2 2 2 2 2 2 2 2 2 2
Output
8
----------------------------------------------------------------------------------------------------
C. Design Tutorial: Make It Nondeterministic
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
gennady korotkevich
petr mitrichev
gaoyuan chen
1 2 3
Output
NO
Input
3
gennady korotkevich
petr mitrichev
gaoyuan chen
3 1 2
Output
YES
Input
2
galileo galilei
nicolaus copernicus
2 1
Output
YES
Input
10
rean schwarzer
fei claussell
alisa reinford
eliot craig
laura arseid
jusis albarea
machias regnitz
sara valestin
emma millstein
gaius worzel
1 2 3 4 5 6 7 8 9 10
Output
NO
Input
10
rean schwarzer
fei claussell
alisa reinford
eliot craig
laura arseid
jusis albarea
machias regnitz
sara valestin
emma millstein
gaius worzel
2 4 9 6 5 7 1 3 8 10
Output
YES
----------------------------------------------------------------------------------------------------
D. Design Tutorial: Inverse the Problem
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
0 2 7
2 0 9
7 9 0
Output
YES
Input
3
1 2 7
2 0 9
7 9 0
Output
NO
Input
3
0 2 2
7 0 9
7 9 0
Output
NO
Input
3
0 1 1
1 0 1
1 1 0
Output
NO
Input
2
0 0
0 0
Output
NO
----------------------------------------------------------------------------------------------------
E. Design Tutorial: Learn from a Game
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
1 3
2 3
1 3
3 2
Output
3
1 1
2 2
2 1
1 1
Input
2 2
1 3
2 3
1 2
2 3
Output
-1
Input
1 4
1 2 3 4
4 3 2 1
Output
-1
Input
4 1
1
2
3
4
3
1
2
4
Output
2
3 1
2 1
1 1
----------------------------------------------------------------------------------------------------
F. Design Tutorial: Change the Goal
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
3 5
6 0
Output
2
1 2
2 2
Input
5
0 0 0 0 0
1 2 3 4 5
Output
-1
Input
3
4 5 6
1 2 3
Output
5
3 1
1 2
2 2
2 3
3 1
Input
3
1 2 3
4 5 6
Output
-1
----------------------------------------------------------------------------------------------------
G. Design Tutorial: Increase the Constraints
time limit per test: 7 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
101010
11110000
3
0 0 3
2 3 4
5 7 1
Output
1
1
0
Input
10001010101011001010100101010011010
101010100101001010100100101010
5
0 0 12
3 9 7
6 4 15
12 15 10
13 3 20
Output
5
4
3
5
13
----------------------------------------------------------------------------------------------------
