Submission #6478841


Source Code Expand

Copy
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     @hamayanhamayan
    /   \     | |
    /   / ̄ ̄ ̄ ̄/  |
  __(__ニつ/     _/ .| .|____
     \/____/ (u ⊃
---------------------------------------------------------------------------------------------------*/














int N, A[201010], B[201010];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N;
	rep(i, 1, N + 1) cin >> A[i];

	rrep(i, N, 1) {
		int other = 0;
		for (int x = i * 2; x <= N; x += i) if (B[x]) other++;
		if (other % 2 != A[i]) B[i] = 1;
	}

	vector<int> ans;
	rep(i, 1, N + 1) if (B[i]) ans.push_back(i);

	int M = ans.size();
	printf("%d\n", M);
	rep(i, 0, M) {
		if(i) printf(" ");
		printf("%d", ans[i]);
	}
	printf("\n");
}





Submission Info

Submission Time
Task D - Preparing Boxes
User hamayanhamayan
Language C++14 (GCC 5.4.1)
Score 400
Code Size 1815 Byte
Status AC
Exec Time 28 ms
Memory 2936 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 11 ms 1404 KB
testcase_1 AC 22 ms 2424 KB
testcase_10 AC 16 ms 1024 KB
testcase_11 AC 10 ms 768 KB
testcase_12 AC 3 ms 512 KB
testcase_13 AC 1 ms 256 KB
testcase_14 AC 1 ms 256 KB
testcase_2 AC 8 ms 1024 KB
testcase_3 AC 14 ms 1532 KB
testcase_4 AC 14 ms 1660 KB
testcase_5 AC 25 ms 2808 KB
testcase_6 AC 16 ms 1784 KB
testcase_7 AC 26 ms 2936 KB
testcase_8 AC 16 ms 1024 KB
testcase_9 AC 3 ms 384 KB
testcase_add0 AC 28 ms 2936 KB