結果
問題 |
No.1972 Modulo Set
|
ユーザー |
|
提出日時 | 2022-06-11 00:31:11 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 702 bytes |
コンパイル時間 | 3,246 ms |
コンパイル使用メモリ | 258,460 KB |
実行使用メモリ | 16,768 KB |
最終ジャッジ日時 | 2024-09-21 07:41:25 |
合計ジャッジ時間 | 6,032 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 WA * 14 |
ソースコード
#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<int, int> mp; rep(i, n) mp[a[i]]++; set<int> s; rep(i, n) { int x = a[i]; int y = m-a[i]; s.insert(min(x, y)); } ll ans = 0; for (int x : s) { int y = m-x; if (x == y) ans++; else ans += max(mp[x], mp[y]); } cout << ans << '\n'; return 0; }