結果
問題 | No.1972 Modulo Set |
ユーザー |
![]() |
提出日時 | 2022-06-10 21:37:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 549 bytes |
コンパイル時間 | 3,818 ms |
コンパイル使用メモリ | 234,232 KB |
実行使用メモリ | 14,976 KB |
最終ジャッジ日時 | 2024-09-21 06:04:37 |
合計ジャッジ時間 | 6,539 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 WA * 13 |
ソースコード
#include <bits/stdc++.h>using namespace std;#include <atcoder/all>using namespace atcoder;using ll=long long;using Graph=vector<vector<int>>;#define INF 1000000000000000000#define MOD 998244353#define MAX 500int main(){int N;ll M;cin>>N>>M;map<ll,int> m;for(int i=0;i<N;i++){ll A;cin>>A;m[A%M]++;}ll ans=0;for(auto p:m){if(2*p.first==M&&p.second>0){ans++;}else{if(p.second>=m[M-p.first]){ans+=p.second;m[M-p.first]=0;}}}cout<<ans<<'\n';}