Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <cmath>
- using namespace std;
- int main() {
- ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
- int n, k;
- cin >> n >> k;
- int arr[n];
- long long sum=0;
- int freq[k];
- for (int i=0; i<k; i++) {
- freq[i] =0;
- }
- for (int i=0; i<n; i++) {
- cin >> arr[i];
- freq[arr[i]%k]++;
- }
- for (int i=1; i<k; i++) {
- if(freq[i] != freq[k-i]) {
- cout << "NO";
- return 0;
- }
- }
- if (freq[0]%2 == 0) cout << "YES";
- else cout << "NO";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment