310081: CF1780A. Hayato and School

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Hayato and School

题意翻译

输入共 $t$ 组数据,每组数据给定一个长度为 $n$ 的序列 $a$,求出在 $a$ 中能否找出三个数,使得这三个数之和为奇数。如果能则输出 `YES` 并另起一行输出这三个数是 $a$ 中的第几个数(如果有多组解输出其一即可),否则输出 `NO`。 保证 $1\le t \le 10^4, 3\le n \le 300, 1\le a_i \le 10^5$。所有数据中的 $n$ 之和 $\le 2\times 10^5$。 --- 样例解释: 对于第 $1$ 组测试数据,选择第 $1, 2, 3$ 个数,使得 $1+1+1=3$,满足条件; 对于第 $2$ 组测试数据,选择第 $1, 3, 4$ 个数,使得 $1+2+2=5$,满足条件; 对于第 $3$ 组测试数据,我们只能选择第 $1, 2, 3$ 个数,但它们加起来的结果是 $1+2+3=6$,是个偶数,不满足条件,所以输出 `NO`。 翻译提供者@\_\_Allen\_123\_\_

题目描述

Today Hayato came home from school with homework. In the assignment, Hayato was given an array $ a $ of length $ n $ . The task was to find $ 3 $ numbers in this array whose sum is odd. At school, he claimed that there are such $ 3 $ numbers, but Hayato was not sure, so he asked you for help. Answer if there are such three numbers, and if so, output indices $ i $ , $ j $ , and $ k $ such that $ a_i + a_j + a_k $ is odd. The odd numbers are integers that are not divisible by $ 2 $ : $ 1 $ , $ 3 $ , $ 5 $ , and so on.

输入输出格式

输入格式


The first line contains a single integer $ t $ ( $ 1 \le t \le 10^4 $ ) — the number of test cases. For each test case, the first line contains one integer $ n $ ( $ 3 \le n \le 300 $ ) — the length of $ a $ . The second line contains $ n $ integers $ a_1, a_2, \ldots, a_n $ ( $ 1 \le a_i \le 10^5 $ ) — the array $ a $ . It is guaranteed that the sum of $ n $ over all test cases does not exceed $ 2\cdot10^5 $ .

输出格式


For each test case, in the first line print one word "YES" (without quotes) if there are $ 3 $ numbers with an odd sum or "NO" (without quotes) if there are no such $ 3 $ numbers. If the answer exists, then on the second line print $ 3 $ distinct integers $ i, j, k $ ( $ 1 \le i, j, k \le n $ ) — the indices of the numbers. If there are several answers, output any.

输入输出样例

输入样例 #1

6
3
1 1 1
4
1 1 2 2
3
1 2 3
5
1 4 5 1 2
4
2 6 2 4
5
5 6 3 2 1

输出样例 #1

YES
1 2 3
YES
3 4 1
NO
YES
1 3 4
NO
YES
1 3 5

说明

In the first test case, there is one way to choose $ 3 $ numbers, and since $ 1 + 1 + 1 = 3 $ , this triple is fine for us. In the second test case, you need to choose the numbers $ 1, 2, 2 $ , since $ 1 + 2 + 2 = 5 $ . In the third test case, there is one way to choose three numbers, but $ 1 + 2 + 3 = 6 $ is an even number, so the required triple does not exist. In the fifth test case, no matter what three numbers we choose, their sum is even.

Input

题意翻译

输入共 $t$ 组数据,每组数据给定一个长度为 $n$ 的序列 $a$,求出在 $a$ 中能否找出三个数,使得这三个数之和为奇数。如果能则输出 `YES` 并另起一行输出这三个数是 $a$ 中的第几个数(如果有多组解输出其一即可),否则输出 `NO`。 保证 $1\le t \le 10^4, 3\le n \le 300, 1\le a_i \le 10^5$。所有数据中的 $n$ 之和 $\le 2\times 10^5$。 --- 样例解释: 对于第 $1$ 组测试数据,选择第 $1, 2, 3$ 个数,使得 $1+1+1=3$,满足条件; 对于第 $2$ 组测试数据,选择第 $1, 3, 4$ 个数,使得 $1+2+2=5$,满足条件; 对于第 $3$ 组测试数据,我们只能选择第 $1, 2, 3$ 个数,但它们加起来的结果是 $1+2+3=6$,是个偶数,不满足条件,所以输出 `NO`。 翻译提供者@\_\_Allen\_123\_\_

Output

**题目大意:**

海斗从学校带回的家庭作业是:给定一个长度为 \( n \) 的序列 \( a \),要找出序列中是否存在三个数,使它们的和为奇数。如果存在,则输出 `YES` 并列出这三个数的索引(如果有多个解,输出其中一个即可);如果不存在,则输出 `NO`。

**输入输出数据格式:**

- **输入格式:**
- 第一行包含一个整数 \( t \)(\( 1 \le t \le 10^4 \)),表示测试用例的数量。
- 每个测试用例有两行,第一行包含一个整数 \( n \)(\( 3 \le n \le 300 \)),表示序列 \( a \) 的长度。
- 第二行包含 \( n \) 个整数 \( a_1, a_2, \ldots, a_n \)(\( 1 \le a_i \le 10^5 \)),表示序列 \( a \) 的元素。
- 保证所有测试用例的 \( n \) 之和不超过 \( 2 \times 10^5 \)。

- **输出格式:**
- 对于每个测试用例,第一行输出 `YES` 或 `NO`。
- 如果答案是 `YES`,则在第二行输出三个不同的整数 \( i, j, k \)(\( 1 \le i, j, k \le n \)),表示这三个数的索引。如果有多个答案,输出其中任意一个。**题目大意:** 海斗从学校带回的家庭作业是:给定一个长度为 \( n \) 的序列 \( a \),要找出序列中是否存在三个数,使它们的和为奇数。如果存在,则输出 `YES` 并列出这三个数的索引(如果有多个解,输出其中一个即可);如果不存在,则输出 `NO`。 **输入输出数据格式:** - **输入格式:** - 第一行包含一个整数 \( t \)(\( 1 \le t \le 10^4 \)),表示测试用例的数量。 - 每个测试用例有两行,第一行包含一个整数 \( n \)(\( 3 \le n \le 300 \)),表示序列 \( a \) 的长度。 - 第二行包含 \( n \) 个整数 \( a_1, a_2, \ldots, a_n \)(\( 1 \le a_i \le 10^5 \)),表示序列 \( a \) 的元素。 - 保证所有测试用例的 \( n \) 之和不超过 \( 2 \times 10^5 \)。 - **输出格式:** - 对于每个测试用例,第一行输出 `YES` 或 `NO`。 - 如果答案是 `YES`,则在第二行输出三个不同的整数 \( i, j, k \)(\( 1 \le i, j, k \le n \)),表示这三个数的索引。如果有多个答案,输出其中任意一个。

加入题单

算法标签: