結果

問題 No.1972 Modulo Set
ユーザー Nzt3Nzt3
提出日時 2022-06-11 03:06:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 265 ms / 2,000 ms
コード長 466 bytes
コンパイル時間 2,135 ms
コンパイル使用メモリ 170,096 KB
実行使用メモリ 15,104 KB
最終ジャッジ日時 2024-04-15 08:57:05
合計ジャッジ時間 6,507 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 3 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 12 ms
5,376 KB
testcase_04 AC 14 ms
5,376 KB
testcase_05 AC 16 ms
5,376 KB
testcase_06 AC 28 ms
5,376 KB
testcase_07 AC 46 ms
5,376 KB
testcase_08 AC 16 ms
5,376 KB
testcase_09 AC 4 ms
5,376 KB
testcase_10 AC 15 ms
5,376 KB
testcase_11 AC 46 ms
5,376 KB
testcase_12 AC 8 ms
5,376 KB
testcase_13 AC 6 ms
5,376 KB
testcase_14 AC 6 ms
5,376 KB
testcase_15 AC 79 ms
5,888 KB
testcase_16 AC 95 ms
7,040 KB
testcase_17 AC 21 ms
5,376 KB
testcase_18 AC 3 ms
5,376 KB
testcase_19 AC 82 ms
7,040 KB
testcase_20 AC 107 ms
7,552 KB
testcase_21 AC 25 ms
5,376 KB
testcase_22 AC 64 ms
6,912 KB
testcase_23 AC 209 ms
12,928 KB
testcase_24 AC 53 ms
7,424 KB
testcase_25 AC 88 ms
9,472 KB
testcase_26 AC 111 ms
6,144 KB
testcase_27 AC 199 ms
13,568 KB
testcase_28 AC 56 ms
7,552 KB
testcase_29 AC 106 ms
9,472 KB
testcase_30 AC 157 ms
11,904 KB
testcase_31 AC 6 ms
5,376 KB
testcase_32 AC 143 ms
11,264 KB
testcase_33 AC 265 ms
15,104 KB
testcase_34 AC 248 ms
14,848 KB
testcase_35 AC 241 ms
14,848 KB
testcase_36 AC 252 ms
14,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long N,M;
  cin>>N>>M;
  map<long long,int>cnt;
  for(int i=0;i<N;i++){
    long long A;
    cin>>A;
    cnt[A%M]+=1;
    cnt[(M-A%M)%M]+=0;
  }
  int ans=0;
  for(auto i:cnt){
    if(i.first>M/2)continue;
    if(i.first*2==M||i.first==0){
      ans+=min(1,i.second);
    }else{
      ans+=max(i.second,cnt[M-i.first]);
    }
  }
  cout<<ans<<'\n';
}
0