Codeforces Round 111 (Div. 2)


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

Examples
Input
2
3 3
Output
2
Input
3
2 1 2
Output
2
----------------------------------------------------------------------------------------------------
B. Unlucky Ticket
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
2421
Output
YES
Input
2
0135
Output
YES
Input
2
3754
Output
NO
----------------------------------------------------------------------------------------------------
C. Find Pair
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 4
2 1
Output
2 2
Input
3 2
3 1 5
Output
1 3
----------------------------------------------------------------------------------------------------
D. Edges in MST
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 5
1 2 101
1 3 100
2 3 2
2 4 2
3 4 1
Output
none
any
at least one
at least one
any
Input
3 3
1 2 1
2 3 1
1 3 2
Output
any
any
none
Input
3 3
1 2 1
2 3 1
1 3 1
Output
at least one
at least one
at least one
----------------------------------------------------------------------------------------------------
E. Buses and People
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 3
1 10 10
5 6 2
6 7 3
5 7 4
5 7 1
1 2 1
1 10 11
Output
4 1 -1
Input
1 1
1 1000000000 1000000000
1 1000000000 1000000000
Output
1
----------------------------------------------------------------------------------------------------
