Submission #6459611


Source Code Expand

Copy
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

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

  int cnt[N + 1];
  fill(cnt, cnt + N + 1, 0);
  vector<int> ans;

  for(int i = N; i >= 1; i--){
    cnt[i] %= 2;
    if(cnt[i] != a[i]){
      ans.push_back(i);
      for(int j = 1; j * j <= i; j++){
        if(i % j == 0){
          if(i != j){
            cnt[i]++;
            cnt[i / j]++;
          } else {
            cnt[i]++;
          }
        }
      }
    }
  }

  cout << ans.size() << endl;
  for(int i = 0; i < ans.size(); i++){
    cout << ans[i] << " ";
  }
  cout << endl;
  return 0;
}

Submission Info

Submission Time
Task D - Preparing Boxes
User syawacha
Language C++14 (GCC 5.4.1)
Score 0
Code Size 889 Byte
Status WA
Exec Time 181 ms
Memory 3064 KB

Judge Result

Set Name All Sample
Score / Max Score 0 / 400 0 / 0
Status
AC × 5
WA × 13
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 WA 43 ms 1280 KB
testcase_1 WA 108 ms 2424 KB
testcase_10 WA 33 ms 1792 KB
testcase_11 AC 21 ms 1280 KB
testcase_12 WA 9 ms 512 KB
testcase_13 AC 1 ms 256 KB
testcase_14 AC 1 ms 256 KB
testcase_2 WA 27 ms 1024 KB
testcase_3 WA 56 ms 1532 KB
testcase_4 WA 60 ms 1660 KB
testcase_5 WA 166 ms 2936 KB
testcase_6 WA 86 ms 1912 KB
testcase_7 WA 181 ms 3064 KB
testcase_8 WA 33 ms 1920 KB
testcase_9 WA 5 ms 384 KB
testcase_add0 WA 148 ms 2936 KB