結果
問題 |
No.1972 Modulo Set
|
ユーザー |
|
提出日時 | 2022-08-07 20:15:18 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 239 ms / 2,000 ms |
コード長 | 658 bytes |
コンパイル時間 | 2,622 ms |
コンパイル使用メモリ | 208,184 KB |
最終ジャッジ日時 | 2025-01-30 19:18:04 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
ソースコード
typedef long long ll; typedef long double ld; #include <bits/stdc++.h> using namespace std; #define int long long signed main(){ ll n,m; std::cin >> n>>m; map<ll,ll> used; ll ans = 0; for (int i = 0; i < n; i++) { ll a; std::cin >> a; used[a%m]++; } map<ll,bool> u; for (auto e : used) { if(e.first*2%m==0){ ans++; u[e.first]=true; }else{ if(!u[e.first]){ ans += max(used[e.first],used[m-e.first]); u[e.first]=true; u[m-e.first]=true; } } } std::cout << ans << std::endl; }