結果
問題 | No.1972 Modulo Set |
ユーザー |
|
提出日時 | 2022-08-07 20:12:11 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 625 bytes |
コンパイル時間 | 2,621 ms |
コンパイル使用メモリ | 206,316 KB |
最終ジャッジ日時 | 2025-01-30 19:17:52 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 WA * 5 |
ソースコード
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==0){ ans++; }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; }