Codeforces Round 937 (Div. 4)


A. Stair, Peak, or Neither?
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
1 2 3
3 2 1
1 5 3
3 4 1
0 0 0
4 1 7
4 5 7
Output
STAIR
NONE
PEAK
PEAK
NONE
NONE
STAIR
----------------------------------------------------------------------------------------------------
B. Upscaling
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1
2
3
4
Output
##
##
##..
##..
..##
..##
##..##
##..##
..##..
..##..
##..##
##..##
##..##..
##..##..
..##..##
..##..##
##..##..
##..##..
..##..##
..##..##
----------------------------------------------------------------------------------------------------
C. Clock Conversion
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
11
09:41
18:06
12:14
00:59
00:00
14:34
01:01
19:07
11:59
12:00
21:37
Output
09:41 AM
06:06 PM
12:14 PM
12:59 AM
12:00 AM
02:34 PM
01:01 AM
07:07 PM
11:59 AM
12:00 PM
09:37 PM
----------------------------------------------------------------------------------------------------
D. Product of Binary Decimals
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
11
121
1
14641
12221
10110
100000
99
112
2024
12421
1001
Output
YES
YES
YES
YES
YES
YES
NO
NO
NO
NO
YES
----------------------------------------------------------------------------------------------------
E. Nearly Shortest Repeating Substring
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
4
abaa
4
abba
13
slavicgslavic
8
hshahaha
20
stormflamestornflame
Output
1
4
13
2
10
----------------------------------------------------------------------------------------------------
F. 0, 1, 2, Tree!
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
10
2 1 3
0 0 1
0 1 1
1 0 2
1 1 3
3 1 4
8 17 9
24 36 48
1 0 0
0 3 1
Output
2
0
1
1
-1
3
6
-1
-1
3
----------------------------------------------------------------------------------------------------
G. Shuffling Songs
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1
pop taylorswift
4
electronic themotans
electronic carlasdreams
pop themotans
pop irinarimes
7
rap eminem
rap drdre
rap kanyewest
pop taylorswift
indierock arcticmonkeys
indierock arcticmonkeys
punkrock theoffspring
4
a b
c d
e f
g h
Output
0
0
4
3
----------------------------------------------------------------------------------------------------
