Submission #6457252


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mkp make_pair
#define rep(i,s,f) for(i=s;i<f;i++)
#define db cout<<'h'<<'i'<<endl 
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define vi vector<int>
#define vii vector<pair<int,int>>
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define PI 3.14159265
#define mod 1000000007
#define mod2 998244353
#define space 100005
#define lg 18
//<<fixed << setprecision(9)

int main()
{
    int n,i,j,t=0;
    boost;
    cin>>n;
    int arr[n+1],ans[n+1]={0};
    rep(i,1,n+1)cin>>arr[i];
    for(i=n;i>n/2;i--)
    {
        if(arr[i]) 
        {
            ans[i]=1;t++;
        }
    }
    for(i=n/2;i>=1;i--)
    {
        int sum=0;
        for(j=2*i;j<=n;j+=i)
        {
            sum+=ans[j];
        }
        if((arr[i]+sum)%2==1)
        {
            ans[i]=1;t++;
        }
    }
    cout<<t<<"\n";
    rep(i,1,n+1)if(ans[i]) cout<<i<<' ';

    return 0;
}

Submission Info

Submission Time
Task D - Preparing Boxes
User fros7_
Language C++14 (GCC 5.4.1)
Score 400
Code Size 1053 Byte
Status AC
Exec Time 26 ms
Memory 2560 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 1024 KB
testcase_1 AC 21 ms 1920 KB
testcase_10 AC 17 ms 1792 KB
testcase_11 AC 11 ms 1280 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 7 ms 768 KB
testcase_3 AC 13 ms 1280 KB
testcase_4 AC 13 ms 1280 KB
testcase_5 AC 23 ms 2304 KB
testcase_6 AC 14 ms 1536 KB
testcase_7 AC 24 ms 2560 KB
testcase_8 AC 17 ms 1792 KB
testcase_9 AC 3 ms 512 KB
testcase_add0 AC 26 ms 2432 KB