#include <iostream>
template <std::size_t N, std::size_t M>
void normalizebyIndex(const int (&src)[N], int (&dest)[M])
{
for (std::size_t i = 0; i != M; ++i) {
dest[i] = src[i * N / M];
}
}
int main()
{
const int a[5] = {0,0,1,0,1};
int b[10]; //Normalized array by index
normalizebyIndex(a, b);
for (auto e : b) {
std::cout << e;
}
std::cout << std::endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdGVtcGxhdGUgPHN0ZDo6c2l6ZV90IE4sIHN0ZDo6c2l6ZV90IE0+CnZvaWQgbm9ybWFsaXplYnlJbmRleChjb25zdCBpbnQgKCZzcmMpW05dLCBpbnQgKCZkZXN0KVtNXSkKewogICAgZm9yIChzdGQ6OnNpemVfdCBpID0gMDsgaSAhPSBNOyArK2kpIHsKICAgICAgICBkZXN0W2ldID0gc3JjW2kgKiBOIC8gTV07CiAgICB9Cn0KCmludCBtYWluKCkKewogICAgY29uc3QgaW50IGFbNV0gPSB7MCwwLDEsMCwxfTsKICAgIGludCBiWzEwXTsgLy9Ob3JtYWxpemVkIGFycmF5IGJ5IGluZGV4CgogICAgbm9ybWFsaXplYnlJbmRleChhLCBiKTsKCiAgICBmb3IgKGF1dG8gZSA6IGIpIHsKICAgICAgICBzdGQ6OmNvdXQgPDwgZTsKICAgIH0KICAgIHN0ZDo6Y291dCA8PCBzdGQ6OmVuZGw7CiAgICByZXR1cm4gMDsKfQo=