結果

問題 No.1972 Modulo Set
ユーザー umezo
提出日時 2022-06-10 22:32:26
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 495 bytes
コンパイル時間 7,397 ms
コンパイル使用メモリ 263,936 KB
最終ジャッジ日時 2025-01-29 20:04:45
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28 TLE * 5 MLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  ll n,m;
  cin>>n>>m;
  vector<ll> A(n);
  rep(i,n) cin>>A[i];
  map<ll,ll> M;
  rep(i,n) M[A[i]%m]++;
  
  ll ans=0;
  if(M[0]>0) ans++;
  if(m%2==0 && M[m/2]>0) ans++;
  for(ll i=1;i<=(m-1)/2;i++){
    ans+=max(M[i],M[m-i]);
  }
  cout<<ans<<endl;
  
  
    
  return 0;
}
0