题库练习 Even Subset Sum Problem
← 上一题 下一题 →

A13313 | Even Subset Sum Problem

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

You are given an array $a$ consisting of $n$ positive integers. Find a non-empty subset of its elements such that their sum is even (i.e. divisible by $2$ ) or determine that there is no such subset.

Both the given array and required subset may contain equal values.

输入格式

The first line contains a single integer $t$ ( $1 \leq t \leq 100$ ), number of test cases to solve. Descriptions of $t$ test cases follow.

A description of each test case consists of two lines. The first line contains a single integer $n$ ( $1 \leq n \leq 100$ ), length of array $a$ .

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ( $1 \leq a_i \leq 100$ ), elements of $a$ . The given array $a$ can contain equal values (duplicates).

输出格式

For each test case output $-1$ if there is no such subset of elements. Otherwise output positive integer $k$ , number of elements in the required subset. Then output $k$ distinct integers ( $1 \leq p_i \leq n$ ), indexes of the chosen elements. If there are multiple solutions output any of them.

输入输出样例

输入 #1
3
3
1 4 3
1
15
2
3 5
输出 #1
1
2
-1
2
1 2
C++ 编辑器
输入
输出