lina_os

Untitled

Dec 17th, 2024
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cmath>
  4.  
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9. ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  10. int n, k;
  11. cin >> n >> k;
  12. int arr[n];
  13. long long sum=0;
  14. int freq[k];
  15. for (int i=0; i<k; i++) {
  16. freq[i] =0;
  17. }
  18. for (int i=0; i<n; i++) {
  19. cin >> arr[i];
  20. freq[arr[i]%k]++;
  21. }
  22.  
  23. for (int i=1; i<k; i++) {
  24. if(freq[i] != freq[k-i]) {
  25. cout << "NO";
  26. return 0;
  27. }
  28. }
  29. if (freq[0]%2 == 0) cout << "YES";
  30. else cout << "NO";
  31. return 0;
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment