Untitled
user_5668965
c_cpp
a year ago
953 B
13
Indexable
#include <bits/stdc++.h>
using i64 = long long;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n;
std::cin >> n;
std::vector<int> a(n);
for (int i = 0; i < n; i++) {
std::cin >> a[i];
}
std::vector<bool> check(n+1);
for (int i = 3; i <= n; i++) {
if (check[i]) {
continue;
}
if (n % i) {
continue;
}
for (int j = i; j <= n; j += i) {
check[j] = true;
}
for (int k = 0; k < n/i; k++) {
bool ok = true;
for (int x = k; x < n; x += n/i) {
if (!a[x]) {
ok = false;
}
}
if (ok) {
std::cout << "YES\n";
return 0;
}
}
}
std::cout << "NO\n";
return 0;
}Editor is loading...
Leave a Comment