#SP0000121. Chọn tập con nhiều phần tử nhất có tổng hợp số (Windblume Ode)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Chọn tập con nhiều phần tử nhất có tổng hợp số (Windblume Ode)
Windblume Ode
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
The Windblume Ode bears an array of pairwise distinct positive integers. Select a subset of positions so that the sum of the selected values is composite.
Maximize the number of selected elements. A positive integer is composite if and it has a positive divisor other than and itself. A nonempty valid subset is guaranteed to exist, and any maximum-size subset is accepted.
Input
The first line contains . The second line contains pairwise distinct positive integers .
Output
Print the maximum subset size on the first line. The second line contains exactly distinct indices from to of the selected elements.
Subtasks
- Subtask 1 (20 points): ; and pairwise distinct.
- Subtask 2 (30 points): ; and pairwise distinct.
- Subtask 3 (50 points): ; and pairwise distinct.
Examples
Input
3
8 1 2
Output
2
1 3
Explanation
The three values sum to , which is prime, so all three cannot be selected. Excluding position (value ) leaves positions and , with sum , a composite number. Thus the maximum subset size is .