Submission #6458171


Source Code Expand

Copy
#include<iostream>
#include<list>
#include<vector>
#include<algorithm>
#include<string>
#include<stdio.h>
#include<math.h>
#include<unordered_map>
#include<map>

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using lst = list<ll>;


int main()
{
	int N,M=0;
	cin >> N;
	vec a(N+1);
	vec b(N+1,0);

	for (int i = 1; i <= N; ++i)
	{
		cin >> a[i];
	}


	for (int i = N; i >= 1; --i)
	{
		int total = 0;
		for (int k = 2; k*i <= N; ++k)
		{
			total += b[k*i];
			total %= 2;
		}
		b[i] = (total + a[i]) % 2;
		M += b[i];
	}
	cout << M << endl;
	for (int i = 1; i <= N; ++i)
		if (b[i] == 1)cout << i << endl;

	return 0;
}

Submission Info

Submission Time
Task D - Preparing Boxes
User mori08
Language C++14 (GCC 5.4.1)
Score 400
Code Size 711 Byte
Status AC
Exec Time 228 ms
Memory 3968 KB

Judge Result

Set Name All Sample
Score / Max Score 400 / 400 0 / 0
Status
AC × 18
AC × 2
Set Name Test Cases
All sample_01, sample_02, testcase_0, testcase_1, testcase_10, testcase_11, testcase_12, testcase_13, testcase_14, testcase_2, testcase_3, testcase_4, testcase_5, testcase_6, testcase_7, testcase_8, testcase_9, testcase_add0
Sample sample_01, sample_02
Case Name Status Exec Time Memory
sample_01 AC 1 ms 256 KB
sample_02 AC 1 ms 256 KB
testcase_0 AC 73 ms 1664 KB
testcase_1 AC 151 ms 3200 KB
testcase_10 AC 38 ms 3328 KB
testcase_11 AC 24 ms 2176 KB
testcase_12 AC 22 ms 512 KB
testcase_13 AC 1 ms 256 KB
testcase_14 AC 1 ms 256 KB
testcase_2 AC 51 ms 1280 KB
testcase_3 AC 89 ms 1920 KB
testcase_4 AC 94 ms 2048 KB
testcase_5 AC 213 ms 3712 KB
testcase_6 AC 131 ms 2304 KB
testcase_7 AC 228 ms 3840 KB
testcase_8 AC 38 ms 3328 KB
testcase_9 AC 6 ms 640 KB
testcase_add0 AC 188 ms 3968 KB