結果
問題 |
No.1972 Modulo Set
|
ユーザー |
![]() |
提出日時 | 2022-06-10 21:36:03 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 753 bytes |
コンパイル時間 | 3,869 ms |
コンパイル使用メモリ | 237,956 KB |
実行使用メモリ | 521,504 KB |
最終ジャッジ日時 | 2024-09-21 06:02:38 |
合計ジャッジ時間 | 10,028 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 MLE * 1 -- * 8 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define repr(i, n) for (int i = (int)(n); i >= 0; i--) #define all(v) v.begin(), v.end() #define mod1 1000000007 #define mod2 998244353 typedef long long ll; int main(){ ll N, M; cin >> N >> M; vector<ll> A(N); rep(i,N) cin >> A[i]; map<ll,ll> mp; for (ll i = 0; i < N; i++){ mp[A[i] % M]++; } ll ans = 0; for (ll i = 1; i < M / 2; i++){ ans += max(mp[i], mp[M - i]); } ans += min(1LL, mp[0]); if (M % 2 == 0){ ans += min(1LL, mp[M / 2]); } else{ ans += max(mp[M / 2], mp[M - M / 2]); } cout << ans << endl; }