結果
問題 |
No.1972 Modulo Set
|
ユーザー |
![]() |
提出日時 | 2022-11-18 15:23:13 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 668 bytes |
コンパイル時間 | 2,248 ms |
コンパイル使用メモリ | 175,696 KB |
実行使用メモリ | 10,112 KB |
最終ジャッジ日時 | 2024-09-19 21:31:06 |
合計ジャッジ時間 | 5,513 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 WA * 13 |
ソースコード
#include <bits/stdc++.h> using namespace std; using lint = long long; int main() { lint n, m; cin >> n >> m; vector<lint> vec(n); for (int i = 0; i < n; i++) cin >> vec[i]; map<lint, lint> ma; for (int i = 0; i < n; i++) ma[vec[i]%m]++; lint ans = 0; for (auto pa : ma) { lint x = pa.first; lint y = pa.second; if (m-x == x) ans++; else if (ma.count(m-x)) { if (m-x < x) continue; else ans += max(y, ma.at(m-x)); } else ans += y; /* if (m-x == x) ans++; else if (m-x < x) break; else { if (ma.count(m-x)) { ans += max(ma.at(m-x), y); } } //*/ } cout << ans << endl; }