結果
問題 |
No.1972 Modulo Set
|
ユーザー |
|
提出日時 | 2022-06-11 00:41:32 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 697 bytes |
コンパイル時間 | 2,784 ms |
コンパイル使用メモリ | 256,288 KB |
実行使用メモリ | 19,712 KB |
最終ジャッジ日時 | 2024-09-21 07:53:45 |
合計ジャッジ時間 | 6,172 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 WA * 13 |
ソースコード
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); ++i) using std::cin; using std::cout; using std::min; using std::max; using std::set; using std::map; using std::vector; using ll = long long; int main() { int n; ll m; cin >> n >> m; vector<ll> a(n); rep(i, n) cin >> a[i]; rep(i, n) a[i] %= m; map<ll, int> mp; rep(i, n) mp[a[i]]++; set<ll> s; rep(i, n) { ll x = a[i]; ll y = m-a[i]; s.insert(min(x, y)); } int ans = 0; for (ll x : s) { ll y = m-x; if (x == y) ans++; else ans += max(mp[x], mp[y]); } cout << ans << '\n'; return 0; }