Submission #7376990


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
typedef long long int64;
#define debug(x) cerr << #x << ":" << x << endl;

int main()
{
  int n;cin>>n;
  vector<int> a(n+1);
  for(int i=0;i<n;++i) cin>>a[i+1];

  // 1-indexedにする
  vector<int> memo(n+1,0);
  for(int i=n;i>=1;--i){

    int sm = 0;
    for(int j=i;j<=n;j+=i){
      sm ^= memo[j];
    }
    if (a[i] != sm) memo[i] ^= 1;
  }

  /* 出力*/
  vector<int> ans;
  for(int i=1;i<=n;++i){
    if (memo[i]) ans.push_back(i);
  }

  cout<<ans.size()<<endl;
  for(auto ai: ans){
    cout<<ai<<endl;
  }
  
  return 0;
}

Submission Info

Submission Time
Task D - Preparing Boxes
User task4233
Language C++14 (GCC 5.4.1)
Score 400
Code Size 617 Byte
Status
Exec Time 229 ms
Memory 3064 KB

Judge Result

Set Name All Sample
Score / Max Score 400 / 400 0 / 0
Status
× 18
× 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 1 ms 256 KB
sample_02 1 ms 256 KB
testcase_0 75 ms 1404 KB
testcase_1 151 ms 2424 KB
testcase_10 36 ms 1792 KB
testcase_11 23 ms 1280 KB
testcase_12 21 ms 512 KB
testcase_13 1 ms 256 KB
testcase_14 1 ms 256 KB
testcase_2 51 ms 1024 KB
testcase_3 89 ms 1532 KB
testcase_4 96 ms 1660 KB
testcase_5 212 ms 2936 KB
testcase_6 130 ms 1912 KB
testcase_7 229 ms 3064 KB
testcase_8 37 ms 1792 KB
testcase_9 5 ms 384 KB
testcase_add0 189 ms 2936 KB