Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
523 B
1
Indexable
Never
#include <iostream>

using namespace std;
int n, k;
int a[100005];
int dem = 0;
int main()
{
    cin >> n >> k;
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    if(n % k != 0) cout << "NO";
    else
    {
        for(int i = 1; i <= n; i++)
            for(int j = i + n/k; j <= n; j += n/k)
                if(a[i] != a[j])
                {
                    dem++;
                }
                if(dem != 0) cout << "NO";
                else cout << "YES";
    }

}
Leave a Comment