Codeforces Round 165 (Div. 2)


A. Fancy Fence
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
30
60
90
Output
NO
YES
YES
----------------------------------------------------------------------------------------------------
B. Multithreading
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
5 2 1 3 4
Output
2
Input
3
1 2 3
Output
0
Input
4
4 3 2 1
Output
3
----------------------------------------------------------------------------------------------------
C. Magical Boxes
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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

Examples
Input
3 2
2 1
1 2.0
1 3.100
Output
1
Input
3 3
1 5.0
2 5.5
3 6.0
Output
0
Input
6 3
1 14.284235
2 17.921382
1 20.328172
3 20.842331
1 25.790145
1 27.204125
Output
2
----------------------------------------------------------------------------------------------------
E. Flawed Flow
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3
3 2 10
1 2 10
3 1 5
Output
1
0
1
Input
4 5
1 2 10
1 3 10
2 3 5
4 2 15
3 4 5
Output
0
0
1
1
0
----------------------------------------------------------------------------------------------------
