Good Bye 2019


A. Card Game
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
2 1 1
2
1
5 2 3
2 3
1 4 5
Output
YES
NO
----------------------------------------------------------------------------------------------------
B. Interesting Subarray
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
5
1 2 3 4 5
4
2 0 1 9
2
2019 2020
Output
NO
YES
1 4
NO
----------------------------------------------------------------------------------------------------
C. Make Good
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
4
1 2 3 6
1
8
2
1 1
Output
0
2
4 4
3
2 6 2
----------------------------------------------------------------------------------------------------
D. Strange Device
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 3
4 9
4 9
4 9
1 2
Output
? 2 3 4
? 1 3 4
? 1 2 4
? 1 2 3
! 3
----------------------------------------------------------------------------------------------------
E. Divide Points
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
0 0
0 1
1 0
Output
1
1 
Input
4
0 1
0 -1
1 0
-1 0
Output
2
1 2 
Input
3
-2 1
1 1
-1 0
Output
1
2 
Input
6
2 5
0 3
-4 -1
-5 -4
1 0
3 -1
Output
1
6 
Input
2
-1000000 -1000000
1000000 1000000
Output
1
1 
----------------------------------------------------------------------------------------------------
F. Awesome Substrings
time limit per test: 8 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
111
Output
6
Input
01010
Output
10
Input
0000
Output
0
Input
1111100000
Output
25
----------------------------------------------------------------------------------------------------
G. Subset with Zero Sum
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
5
0 1 2 3 4
4
-3 1 1 1
Output
1
1 
4
1 4 3 2 
----------------------------------------------------------------------------------------------------
H. Number of Components
time limit per test: 8 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 3
50 40 30 20 10
1 25
3 45
1 48
Output
3
3
4
----------------------------------------------------------------------------------------------------
I. Xor on Figures
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
5 5 5 5
2 6 2 3
0 0 2 0
0 0 0 0
5
1 1
1 2
1 3
1 4
2 4
Output
3
----------------------------------------------------------------------------------------------------
