Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define int long long
- const int N = 1e5 + 5;
- int a[N] , cnt[N];
- signed main()
- {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- int n , k;
- cin >> n >> k;
- for(int i = 0; i < n; i++){
- cin >> a[i];
- a[i] %= k;
- cnt[a[i]]++;
- }
- int ans = 0;
- for(int i = 1; (i + i) < k; i++){
- ans += max(cnt[i] , cnt[k - i]);
- }
- if(cnt[0] > 0)
- ans++;
- if(k % 2 == 0 && cnt[k / 2] > 0)
- ans++;
- cout << ans << '\n';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement