Problem:


Score : 400 points

Problem Statement

There are N empty boxes arranged in a row from left to right.
The integer i is written on the i-th box from the left (1 \leq i \leq N).

For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it.

We say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied:

For every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2.

Does there exist a good set of choices? If the answer is yes, find one good set of choices.

Constraints

All values in input are integers.

1 \leq N \leq 2 \times 10^5

a_i is 0 or 1.

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 ... a_N

Output

If a good set of choices does not exist, print -1.

If a good set of choices exists, print one such set of choices in the following format:

M
b_1 b_2 ... b_M

where M denotes the number of boxes that will contain a ball, and b_1,\ b_2,\ ...,\ b_M are the integers written on these boxes, in any order.

Sample Input 1

3
1 0 0

Sample Output 1

1
1

Consider putting a ball only in the box with 1 written on it.

There are three boxes with multiples of 1 written on them: the boxes with 1, 2, and 3. The total number of balls contained in these boxes is 1.

There is only one box with a multiple of 2 written on it: the box with 2. The total number of balls contained in these boxes is 0.

There is only one box with a multiple of 3 written on it: the box with 3. The total number of balls contained in these boxes is 0.

Thus, the condition is satisfied, so this set of choices is good.

Sample Input 2

5
0 0 0 0 0

Sample Output 2

0

Putting nothing in the boxes can be a good set of choices.



Sample input:
3
1 0 0


Sample output:
1
1

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = []
for i in range(n-1, -1, -1):
    if sum(a[i:n-1:i+1])%2==1:
        a[i]+=1
        ans.append(i+1)
a.sort()
print(len(ans))
print(*ans)

Submission status: Wrong Answer

Solution code:
#D
n = int(input())
a = list(map(int,input().split()))

box = [0 for _ in range(n)]
result = []
def baisu(n,max_n):
    ans = []
    cnt = 1
    while n*cnt <= max_n:
        ans.append(n*cnt)
        cnt += 1  
    return ans

for i in range(n-1,-1,-1):
    if i+1 > n//2:
        box[i] = a[i]
        
    else:
        num = baisu(i+1,n)
        tmp = 0
        for j in num:
            tmp += a[j-1]
        if tmp % 2 == a[i]:
            box[i] = 0
            
        else:
            box[i] = 1
            
for i,j in enumerate(box):
    if j == 1:
        result.append(i+1)
        
if result == []:
    print(0)
else:
    print(len(result))
    print(*result)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
As = np.array(list(map(int, input().split())))

res = np.zeros_like(As)
for idx, ai in zip(np.arange(N-1, -1, -1), As[::-1]):
    oe = res[idx::(idx+1)].sum() % 2
    res[idx] = ai ^ oe

idxs = np.where(res)[0]
print(len(idxs))
print(" ".join(idxs.astype(str)))

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
As = np.array(list(map(int, input().split())))

res = np.zeros_like(As)
for idx, ai in zip(np.arange(N-1, -1, -1), As[::-1]):
    oe = res[idx::(idx+1)].sum() % 2
    res[idx] = ai ^ oe


idxs = np.where(res)[0]
print(len(idxs))
print(" ".join(idxs.astype(str)))

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
As = np.array([0] + list(map(int, input().split())))

res = np.zeros_like(As)
for idx, ai in enumerate(As[::-1]):
    idx = N - idx
    if idx == 0:
        break
    oe = res[::idx].sum() % 2
    res[idx] = ai ^ oe

print(N)
print(" ".join(res[1:].astype(str)))

Submission status: Wrong Answer

Solution code:
n = int(input()) # 入力が1つ
# map(int, input().split()) # 入力が複数
nums = [int(i) for i in input().split()] # 配列で数字
box = [-1] * n
for i in range(n, 0, -1):
    c = i * 2
    ball = nums[i - 1]
    while c <= n:
        ball ^= nums[c - 1]
        c += i
    box[i - 1] = ball

ans = box.count(1)
print(ans)
ball = []
for i in range(n):
    if box[i] == 1:
        ball.append(i + 1)
print(*ball)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input()) # 入力が1つ
# map(int, input().split()) # 入力が複数
nums = [int(i) for i in input().split()] # 配列で数字
box = [-1] * n
for i in range(1, n + 1)[::-1]:
    c = i * 2
    ball = nums[i - 1]
    while c <= n:
        ball = ball ^ nums[c - 1]
        c += i
    box[i - 1] = ball
else:
    ans = box.count(1)
    print(ans)
    ball = []
    for i in range(n):
        if box[i] == 1:
            ball.append(str(i + 1))
    print(' '.join(ball))

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input()) # 入力が1つ
# map(int, input().split()) # 入力が複数
nums = [int(i) for i in input().split()] # 配列で数字
box = [-1] * n
for i in range(1, n + 1)[::-1]:
    c = i * 2
    ball = nums[i - 1]
    while c <= n:
        ball = ball ^ nums[c - 1]
        c += i
    box[i - 1] = ball
else:
    ans = box.count(1)
    print(ans)
    ball = []
    for i in range(n):
        if box[i] == 1:
            ball.append(i + 1)
    print(*ball)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input()) # 入力が1つ
# map(int, input().split()) # 入力が複数
nums = [int(i) for i in input().split()] # 配列で数字
box = [-1] * n
for i in range(1, n + 1)[::-1]:
    c = i * 2
    ball = nums[i - 1]
    while c <= n:
        ball = ball ^ nums[c - 1]
        c += i
    box[i - 1] = ball
else:
    ans = box.count(1)
    print(ans)
    ball = []
    for i in range(n):
        if box[i]:
            ball.append(i + 1)
    print(*ball)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input()) # 入力が1つ
# map(int, input().split()) # 入力が複数
nums = [int(i) for i in input().split()] # 配列で数字
box = [-1] * n
for i in range(1, n + 1)[::-1]:
    c = i * 2
    ball = nums[i - 1]
    while c <= n:
        ball = ball ^ nums[c - 1]
        c += i
    box[i - 1] = ball
else:
    ans = sum(box)
    print(ans)
    ball = []
    for i in range(n):
        if box[i]:
            ball.append(i + 1)
    print(*ball)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input()) # 入力が1つ
# map(int, input().split()) # 入力が複数
nums = [int(i) for i in input().split()] # 配列で数字
box = [0] * n
for i in range(1, n + 1)[::-1]:
    c = i * 2
    ball = nums[i - 1]
    while c <= n:
        ball = ball ^ nums[c - 1]
        c += i
    box[i - 1] = ball
else:
    ans = sum(box)
    if ans == 0:
        print(ans)
    else:
        print(ans)
        ball = []
        for i in range(n):
            if box[i]:
                ball.append(i + 1)
        print(*ball)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input()) # 入力が1つ
# map(int, input().split()) # 入力が複数
nums = [int(i) for i in input().split()] # 配列で数字
box = [0] * n
for i in range(1, n + 1)[::-1]:
    s = 0
    for j in range(i, n, i):
        s += nums[j - 1]
    s %= 2
    if nums[i - 1] == s:
        box[i - 1] = s
    else:
        print(-1)
        break
else:
    ans = sum(box)
    if ans == 0:
        print(ans)
    else:
        print(ans)
        ball = []
        for i in range(n):
            if box[i]:
                ball.append(i + 1)
        print(*ball)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input()) # 入力が1つ
# map(int, input().split()) # 入力が複数
nums = [int(i) for i in input().split()] # 配列で数字
box = [0] * n
for i in range(n)[::-1]:
    s = 0
    for j in range(i, n, i + 1):
        s += nums[j]
    s %= 2
    if nums[i] == s:
        box[i] = s
    else:
        print(-1)
        break
else:
    ans = sum(box)
    if ans == 0:
        print(ans)
    else:
        print(ans)
        ball = []
        for i in range(n):
            if box[i]:
                ball.append(i + 1)
        print(*ball)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input()) # 入力が1つ
# map(int, input().split()) # 入力が複数
nums = [int(i) for i in input().split()] # 配列で数字
box = [0] * n
for i in range(n)[::-1]:
    s = 0
    for j in range(i, n, i + 1):
        s += nums[j]
    s %= 2
    if nums[i] == s:
        box[i] = s
    else:
        print(-1)
        break
else:
    ans = sum(box)
    if ans == 0:
        print(ans)
    else:
        print(ans)
        print(*box)

Submission status: Wrong Answer

Solution code:
N=int(input())
A=list(map(int,input().split()))
B=[0]*N
for n in range(N,0,-1):
    if A[n-1]==1:
        B[n-1]=1
        for x in range(1,int(n**0.5)+1):
            if n%x==0:
                if x**2==n:
                    A[x-1]=A[x-1]|1
                else:
                    y=n//x
                    A[x-1]=A[x-1]^1
                    A[y-1]=A[y-1]^1
print(sum(B))
for i in range(N):
    if B[i]==1:
        print(i+1,end=" ")

Submission status: Wrong Answer

Solution code:
N=int(input())
a=[0]+list(map(int,input().split()))+[0]*N
b=[0]*(N+1)

def rec(x):
    if x==0:
        return

    for i in range((x+1)//2,x+1):
        if (a[i*2]+1)%2==a[i]:
            b[i]=1
        else:
            b[i]=0
    
    rec(x//2)

rec(N)

for i in range(1,N+1):
    j=1
    cnt=0
    while i*j<=N:
        cnt+=b[i*j]
        j+=1
    
    if cnt%2!=a[i]:
        print('-1')
        exit(0)

M=0
s=''
for i in range(1,N+1):
    if b[i]==1:
        s+=str(b[i])+' '
        M+=1
print(M)
if len(s)>0:
    print(s[:-1])

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))
    for i in range(n // 2, 0, -1):
        a[i - 1] = sum(a[0:i:i]) % 2

    print(sum(a))
    ans = []
    for i in range(n):
        if a[i] != 0:
            ans.append(str(i + 1))
    if not ans:
        print(0)
    else:
        print(' '.join(ans))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys

MOD = 2  # type: int


def solve(N: int, a: "List[int]"):

    box = [0]*N

    for x in range(N, 0, -1):
        ca = N // x
        t = 0
        for i in range(1,ca+1):
            t += box[i*x-1]
        
        if t%2 != a[x-1]:
            box[x-1] = 1

    print(sum(box))
    if sum(box) !=0:
        ans = [x for x in range(N+1) if box[x-1]==1]
        print(*ans)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys

MOD = 2  # type: int


def solve(N: int, a: "List[int]"):

    box = [0]*N

    for x in range(N, 0, -1):
        ca = N // x
        t = 0
        for i in range(1,ca+1):
            t += box[i*x-1]
        if t%2 != a[x-1]:
            box[x-1] = 1

    print(sum(box))
    if sum(box) !=0:
        ans = [x for x in range(N) if box[x-1]==1]
        print(*ans)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
for i in range(n,0,-1):
  if l[i-1]:
    l[i-1]=sum(l[i-1::i])%2
  print(l)
print(sum(l))
print(*[i+1 for i in range(n) if l[i]])

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
l=[0]*n
for i in range(n,0,-1):
  if a[i-1]:
    l[i-1]=sum(a[i-1::i])%2
print(sum(l))
print(*[i+1 for i in range(n) if l[i]])

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
l=[0]*n
for i in range(n,0,-1):
  if a[i-1]:
    l[i-1]=sum(a[j-1] for j in range(i,n+1,i))%2
print(sum(l))
print(*[i+1 for i in range(n) if l[i]])

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
l=[0]*n
for i in range(n):
  if a[i]:
    i+=1
    for j in range(int(i**.5)):
      j+=1
      if i%j<1:
        l[j-1]^=1
        if j*j<i:
          l[i//j-1]^=1
print(sum(l))
print(*[i+1 for i in range(n) if l[i]])

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
l=[0]*n
for i in range(n):
  if a[i]:
    i+=1
    for j in range(int(i**.5)):
      j+=1
      if i%j<1:
        l[j-1]^=1
        if j*j<i:
          l[i//j-1]^=1
print(sum(l))
for i in range(n):
  if l[i]:
    print(i+1)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
l=[0]*n
for i in range(n):
  if a[i]:
    i+=1
    for j in range(int(i**.5)):
      j+=1
      if i%j<1:
        l[j-1]^=1
        if j*j<i:
          l[i//j-1]^=1
print(*l)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value

N = ii()
A = li()
'''
for i in reversed(range(N//2)):
    ind = i+1
    ind += i+1
    while(ind-1 < N):
        A[i] += A[ind-1]
        ind += i+1
    A[i] %= 2
'''

for i in range(N):
    ind = 2*(i+1)
    while(ind-1 < N):
        A[i] += A[ind-1]
        ind += i+1
    if i < N//2:
        A[i] %= 2

ans = ''
print(sum(A))
for i in range(N):
    if A[i]%2 == 1:
        ans += str(i+1) + ' '

if ans != '':
    print(ans[:-1])

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value

N = ii()
A = li()
'''
for i in reversed(range(N//2)):
    ind = i+1
    ind += i+1
    while(ind-1 < N):
        A[i] += A[ind-1]
        ind += i+1
    A[i] %= 2
'''
for i in range(N):
    ind = 2*(i+1)
    while(ind-1 < N):
        A[i] += A[ind-1]
        ind += i+1
    A[i] %= 2

ans = ''
print(sum(A))
for i in range(N):
    if A[i]%2 == 1:
        ans += str(i+1) + ' '

if ans != '':
    print(ans[:-1])

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value

N = ii()
A = li()

A_f = A[:N//2]
A_l = A[N//2:]

for i in reversed(range(N//2)):
    ind = i+1
    ind += i+1
    while(ind-1 < N):
        A[i] += A[ind-1]
        ind += i+1
    A[i] %= 2

#table += A_l

ans = ''
print(sum(A))
print(A)
for i in range(N):
    if A[i]%2 == 1:
        ans += str(i+1) + ' '

if ans != '':
    print(ans[:-1])

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value

N = ii()
A = li()

A_f = A[:N//2]
A_l = A[N//2:]

table = [0] * (N//2)

for i in reversed(range(N//2)):
    ind = i+1
    while(ind < N):
        table[i] += A[ind-1]
        ind += i+1
    table[i] %= 2

table += A_l

ans = ''
print(sum(table))
for i in range(N):
    if table[i]%2 == 1:
        ans += str(i+1) + ' '

print(ans[:-1])

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value

N = ii()
A = li()

A_f = A[:N//2]
A_l = A[N//2:]

table = [0] * (N//2)

for i in reversed(range(N//2)):
    ind = i+1
    while(ind < N):
        table[i] += A[ind-1]
        ind += i+1
    table[i] %= 2

table += A_l

ans = ''
print(sum(table))
for i in range(N):
    if table[i]%2 == 1:
        ans += str(i+1) + ' '
print(ans)

Submission status: Wrong Answer

Solution code:
def check(n):
    num=int(n**0.5)
    l=[1]
    for i in range(2,num+1):
        if n%i==0:
            l.append(i)
            l.append(n//i)
    return l

n=int(input())
a=list(map(int,input().split()))

box=[0]*n
cnt=0
ans=[0]*n
for i in range(n):
    if a[-(i+1)]==box[i]:continue
    cnt+=1
    ans[-(i+1)]=1
    box[i]=(box[i]+1)%2
    l=check(n-i)
    for j in l:
        box[j-1]=(box[j-1]+1)%2

print(cnt)
if cnt==0:exit()
for i in range(n):
    if ans[i]:
        print(i+1,end=' ')

Submission status: Wrong Answer

Solution code:
N=int(input())
A=list(map(int,input().split()))
b=(N//2)+1

ans=[]
for _ in range(N):
    ans.append(0)
for i in range(b-1,N):
    ans[i]=A[i]


for j in range(0,b-1)[::-1]:
    n=2
    sum=0
    while True:
        if n*(j+1)-1<=N-1:
            sum+=ans[n*(j+1)-1]
            n+=1
        else:
            break
    if sum%2!=A[j]:
        ans[j]=1

M=ans.count(1)
print(M)
print(*ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(i) for i in input().split()]

ans = [0] * n
for i in range(n, 0, -1):
    if sum(ans[i - 1:n + 1:i]) % 2 != a[i - 1]:
        ans[i - 1] = 1

print(*ans)

Submission status: Wrong Answer

Solution code:
m = int(input())
num_list = list(map(int,input().split()))
ans_list = [0]*m
print_list = []
for i in range(m,0,-1):
    if num_list[i-1] == 0:
        cnt = 0
        for j in range(2**10000):
            if (j+2)*i > m:
                break
            else:
                cnt += ans_list[i*(j+2)-1]
        if cnt % 2 == 1:
            ans_list[m-i-1] = 1
            print_list.append(i)
    elif num_list[i-1] == 1:
        cnt = 0
        for j in range(2**10000):
            if (j+2)*i > m:
                break
            else:
                cnt += ans_list[i*(j+2)-1]
        if cnt % 2 == 0:
            ans_list[i-1] = 1
            print_list.append(i)
            
if not print_list:
    print(0)
    
else:
    print(sum(ans_list))
    print(*print_list)

Submission status: Wrong Answer

Solution code:
m = int(input())
num_list = list(map(int,input().split()))
ans_list = [0]*m
print_list = []
for i in range(m,0,-1):
    if num_list[i-1] == 0:
        cnt = 0
        for j in range(2**100000):
            if (j+2)*i > m:
                break
            else:
                cnt += ans_list[i*(j+2)-1]
        if cnt % 2 == 1:
            ans_list[m-i-1] = 1
            print_list.append(i)
    elif num_list[i-1] == 1:
        cnt = 0
        for j in range(2**10):
            if (j+2)*i > m:
                break
            else:
                cnt += ans_list[i*(j+2)-1]
        if cnt % 2 == 0:
            ans_list[i-1] = 1
            print_list.append(i)
            
if not print_list:
    print(0)
    
else:
    print(sum(ans_list))
    print(*print_list)

Submission status: Wrong Answer

Solution code:
m = int(input())
num_list = list(map(int,input().split()))
ans_list = [0]*m
print_list = []
for i in range(m):
    if num_list[m-i-1] == 0:
        cnt = 0
        for j in range(2**10000):
            if (j+1)*(m-i) > m:
                break
            else:
                cnt += ans_list[(m-i)*(j+1)-1]
        if cnt % 2 == 1:
            ans_list[m-i-1] = 1
            print_list.append(m-i)
    elif num_list[m-i-1] == 1:
        cnt = 0
        for j in range(2**10):
            if (j+1)*(m-i) > m:
                break
            else:
                cnt += ans_list[(m-i)*(j+1)-1]
        if cnt % 2 == 0:
            ans_list[m-i-1] = 1
            print_list.append(m-i)
            
if not print_list:
    print(0)
    
else:
    print(sum(ans_list))
    print(*print_list)

Submission status: Wrong Answer

Solution code:
m = int(input())
num_list = list(map(int,input().split()))
ans_list = [0]*m
print_list = []
for i in range(m,0,-1):
    if num_list[i-1] == 0:
        cnt = 0
        for j in range(2,m//i+1):
            cnt += ans_list[i*j-1]
        if cnt % 2 == 1:
            ans_list[m-i-1] = 1
            print_list.append(i)
    elif num_list[i-1] == 1:
        cnt = 0
        for j in range(2,m//i+1):
            cnt += ans_list[i*j-1]
        if cnt % 2 == 0:
            ans_list[i-1] = 1
            print_list.append(i)
            
if not print_list:
    print(0)
    
else:
    print(sum(ans_list))
    print(*print_list)

Submission status: Wrong Answer

Solution code:
m = int(input())
num_list = list(map(int,input().split()))
ans_list = [0]*m
print_list = []
for i in range(m,0,-1):
    if num_list[i-1] == 0:
        cnt = 0
        for j in range(2**10):
            if (j+2)*i > m:
                break
            else:
                cnt += ans_list[i*(j+2)-1]
        if cnt % 2 == 1:
            ans_list[m-i-1] = 1
            print_list.append(i)
    elif num_list[i-1] == 1:
        cnt = 0
        for j in range(2**10):
            if (j+2)*i > m:
                break
            else:
                cnt += ans_list[i*(j+2)-1]
        if cnt % 2 == 0:
            ans_list[i-1] = 1
            print_list.append(i)
            
if not print_list:
    print(0)
    
else:
    print(sum(ans_list))
    print(*print_list)

Submission status: Wrong Answer

Solution code:
m = int(input())
num_list = list(map(int,input().split()))
ans_list = [0]*m
print_list = []
for i in range(m):
    if num_list[m-i-1] == 0:
        cnt = 0
        for j in range(2**10):
            if (j+2)*(m-i) > m:
                break
            else:
                cnt += ans_list[(m-i)*(j+2)-1]
        if cnt % 2 == 1:
            ans_list[m-i-1] = 1
            print_list.append(m-i)
    elif num_list[m-i-1] == 1:
        cnt = 0
        for j in range(2**10):
            if (j+2)*(m-i) > m:
                break
            else:
                cnt += ans_list[(m-i)*(j+2)-1]
        if cnt % 2 == 0:
            ans_list[m-i-1] = 1
            print_list.append(m-i)
            
if not print_list:
    print(0)
    
else:
    print(sum(ans_list))
    print(*print_list)

Submission status: Wrong Answer

Solution code:
m = int(input())
num_list = list(map(int,input().split()))
ans_list = [0]*m
print_list = []
for i in range(m):
    if num_list[m-i-1] == 0:
        cnt = 0
        for j in range(2**10):
            if (j+1)*(m-i) > m:
                break
            else:
                cnt += ans_list[(m-i)*(j+1)-1]
        if cnt % 2 == 1:
            ans_list[m-i-1] = 1
            print_list.append(m-i)
    elif num_list[m-i-1] == 1:
        cnt = 0
        for j in range(2**10):
            if (j+1)*(m-i) > m:
                break
            else:
                cnt += ans_list[(m-i)*(j+1)-1]
        if cnt % 2 == 0:
            ans_list[m-i-1] = 1
            print_list.append(m-i)
            
if not print_list:
    print(0)
    
else:
    print(sum(ans_list))
    print(*print_list)

Submission status: Wrong Answer

Solution code:
m = int(input())
num_list = list(map(int,input().split()))
ans_list = [0]*m
print_list = []
for i in range(m):
    if num_list[m-i-1] == 0:
        cnt = 0
        for j in range(2**10):
            if (j+1)*(m-i) >= m:
                break
            else:
                cnt += ans_list[(m-i)*(j+1)-1]
        if cnt % 2 == 1:
            ans_list[m-i-1] = 1
            print_list.append(m-i)
    elif num_list[m-i-1] == 1:
        cnt = 0
        for j in range(2**10):
            if (j+1)*(m-i) >= m:
                break
            else:
                cnt += ans_list[(m-i)*(j+1)-1]
        if cnt % 2 == 0:
            ans_list[m-i-1] = 1
            print_list.append(m-i)
            
if not print_list:
    print(0)
    
else:
    print(sum(ans_list))
    print(*print_list)

Submission status: Wrong Answer

Solution code:
m = int(input())
num_list = list(map(int,input().split()))
ans_list = [0]*m
print_list = []
for i in range(m):
    if num_list[m-i-1] == 0:
        cnt = 0
        for j in range(2**10):
            if (j+1)*(m-i) >= m:
                break
            else:
                cnt += ans_list[(m-i)*(j+1)-1]
        if cnt % 2 == 1:
            ans_list[m-i-1] = 1
            print_list.append(m-i)
    elif num_list[m-i-1] == 1:
        cnt = 0
        for j in range(2**10):
            if (j+1)*(m-i) > m:
                break
            else:
                cnt += ans_list[(m-i)*(j+1)-1]
        if cnt % 2 == 0:
            ans_list[m-i-1] = 1
            print_list.append(m-i)
            
if not print_list:
    print(0)
    
else:
    print(sum(ans_list))
    print(*print_list)

Submission status: Wrong Answer

Solution code:
m = int(input())
num_list = list(map(int,input().split()))
ans_list = [0]*m
print_list = []
for i in range(m):
    if num_list[m-i-1] == 0:
        cnt = 0
        for j in range(2**10):
            if (j+1)*(m-i) > m:
                break
            else:
                cnt += ans_list[(m-i)*(j+1)-1]
        if cnt % 2 == 1:
            ans_list[m-i-1] = 1
            print_list.append(m-i)
    elif num_list[m-i-1] == 1:
        cnt = 0
        for j in range(2**10):
            if (j+1)*(m-i) > m:
                break
            else:
                cnt += ans_list[(m-i)*(j+1)-1]
        if cnt % 2 == 0:
            ans_list[m-i-1] = 1
            print_list.append(m-i)
            
if not print_list:
    print(0)
    
else:
    print(sum(ans_list))
    print(*print_list[::-1])

Submission status: Wrong Answer

Solution code:
m = int(input())
num_list = list(map(int,input().split()))
ans_list = [0]*m
print_list = []
for i in range(m):
    if num_list[m-i-1] == 0:
        continue
    elif num_list[m-i-1] == 1:
        cnt = 0
        for j in range(2**10):
            if (j+1)*(m-i) > m:
                break
            else:
                cnt += ans_list[(m-i)*(j+1)-1]
        if cnt % 2 == 0:
            ans_list[m-i-1] = 1
            print_list.append(m-i)
            
if not print_list:
    print(0)
    
else:
    print(sum(ans_list))
    print(*print_list)

Submission status: Wrong Answer

Solution code:
m = int(input())
num_list = list(map(int,input().split()))
ans_list = [0]*m
print_list = []
for i in range(m):
    if num_list[m-i-1] == 0:
        continue
    elif num_list[m-i-1] == 1:
        cnt = 0
        for j in range(2**10):
            if (j+1)*(m-i) > m:
                break
            else:
                cnt += ans_list[(m-i)*(j+1)-1]
        if cnt % 2 == 0:
            ans_list[m-i-1] = 1
            print_list.append(m-i)
            
if not print_list:
    print(0)
    
else:
    print(*print_list)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))

ans = [0 for _ in range(n)]
for i in reversed(range(n)):
  tmp = 0
  for j in range((i+1)*2-1,n,i+1):
    if a[j] == 1:
      tmp += 1
  if tmp % 2 == 1:
    ans[i] = 1

c = 0
l = []
for i in range(n):
  if ans[i] == 1:
    l.append(i+1)
    c += 1
if c == 0:
  print(0)
else:
  l = [str(i) for i in l]
  l = " ".join(l)
  print(c)
  print(l)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))

ans = [0 for _ in range(n)]
for i in reversed(range(n)):
  tmp = 0
  for j in range(i*2,n,i+1):
    if a[j] == 1:
      tmp += 1
  if tmp % 2 == 1:
    ans[i] = 1

c = 0
l = []
for i in range(n):
  if ans[i] == 1:
    l.append(i+1)
    c += 1
if c == 0:
  print(0)
else:
  l = [str(i) for i in l]
  l = " ".join(l)
  print(c)
  print(l)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
ans = [0]*(N+1)

for i in range(N,0,-1):
    c = 0
    for j in range(i,N,i):
        c += ans[j]
    if (A[i-1] == 0 and c % 2 == 1) or (A[i-1] == 1 and c % 2 == 0):
        ans[i] = 1

print(sum(ans))
for i in range(1,N+1):
    if ans[i] == 1:
        print(i,end=" ")

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
K = [0]*(N+1)
ans = [0]*(N+1)

for i in range(N,0,-1):
    if (A[i-1] == 0 and K[i] % 2 == 1) or (A[i-1] == 1 and K[i] % 2 == 0):
        ans[i] = 1
        K[1] += 1
        if i > 3:
            for j in range(2,int(i**(0.5))+1):
                if N % j == 0:
                    K[j] += 1
                    t = N//j
                    if t != j:
                        K[t] += 1
print(sum(ans))
for i in range(1,N+1):
    if ans[i] == 1:
        print(i,end=" ")

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int,input().split()))
K = [0]*(N+1)
ans = [0]*(N+1)

for i in range(N,0,-1):
    if (A[i-1] == 0 and K[i] % 2 == 1) or (A[i-1] == 1 and K[i] % 2 == 0):
        ans[i] = 1
        K[1] += 1
        if i > 3:
            for j in range(2,int(i**(0.5))+1):
                if N % j == 0:
                    K[j] += 1
                    K[N//j] += 1
print(sum(ans))
for i in range(1,N+1):
    if ans[i] == 1:
        print(i,end=" ")

Submission status: Wrong Answer

Solution code:
N=int(input())
a=list(map(int,input().split()))
B=[]
for i in range(N//2,N):
    if a[i]==1:
        B.append(i+1)
for i in range(N//2)[::-1]:
    asum=0
    x=i+1
    for j in range(i+x,N,x):
        asum=asum+a[j]
    if asum%2!=a[i]:
        a[i]=1
        B.append(i+1)
count=sum(a)
print(count)
if count!=0:
    print(*B)