?
# | Author | Problem | Lang | Verdict | Time | Memory | Sent | Judged | |
---|---|---|---|---|---|---|---|---|---|
190503513 |
Contestant: AlanDiakov |
1780A - 39 | Java 8 | Accepted | 233 ms | 0 KB | 2023-01-25 17:44:13 | 2023-01-25 19:43:13 |
import java.io.*; import java.util.*; public class A { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); PrintStream out = System.out; int t = Integer.parseInt(br.readLine()); for (int i = 0; i < t; i++) { int n = Integer.parseInt(br.readLine()); String[] in = br.readLine().split(" "); int evens = 0; int odds = 0; int[] arr = new int[n]; for (int j = 0; j < n; j++) { arr[j] = Integer.parseInt(in[j]); if (arr[j] % 2 == 1) { odds++; } else { evens++; } } if (odds == 0 || (odds < 3 && evens < 2)) { out.println("NO"); continue; } out.println("YES"); ArrayList<Integer> poses = new ArrayList<>(); if (odds < 3) { int counta = 0; int countb = 0; for (int j = 0; j < n; j++) { if (counta < 1 && arr[j] %2 == 1) { poses.add(j+1); counta++; } if (countb < 2 && arr[j] %2 == 0) { poses.add(j+1); countb++; } } } else { int counta = 0; for (int j = 0; j < n; j++) { if (counta < 3 && arr[j] %2 == 1) { poses.add(j+1); counta++; } } } out.println(poses.get(0) + " " + poses.get(1) + " " + poses.get(2)); } System.out.flush(); } }
?
?
?
?