結果

問題 No.1972 Modulo Set
ユーザー SSRSSSRS
提出日時 2022-06-10 21:22:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 495 bytes
コンパイル時間 1,537 ms
コンパイル使用メモリ 181,960 KB
実行使用メモリ 19,680 KB
最終ジャッジ日時 2023-10-21 04:47:21
合計ジャッジ時間 7,353 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 14 ms
4,348 KB
testcase_04 AC 20 ms
4,348 KB
testcase_05 WA -
testcase_06 AC 38 ms
4,368 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 4 ms
4,348 KB
testcase_10 WA -
testcase_11 AC 55 ms
4,632 KB
testcase_12 AC 9 ms
4,348 KB
testcase_13 AC 6 ms
4,368 KB
testcase_14 AC 6 ms
4,412 KB
testcase_15 AC 67 ms
7,008 KB
testcase_16 AC 75 ms
8,592 KB
testcase_17 AC 25 ms
5,128 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 65 ms
8,592 KB
testcase_20 AC 78 ms
9,384 KB
testcase_21 AC 30 ms
5,268 KB
testcase_22 AC 53 ms
8,376 KB
testcase_23 AC 123 ms
17,040 KB
testcase_24 AC 44 ms
9,052 KB
testcase_25 AC 76 ms
11,804 KB
testcase_26 WA -
testcase_27 AC 141 ms
17,832 KB
testcase_28 AC 46 ms
9,292 KB
testcase_29 AC 70 ms
12,288 KB
testcase_30 AC 106 ms
15,456 KB
testcase_31 AC 7 ms
4,348 KB
testcase_32 AC 92 ms
14,400 KB
testcase_33 AC 160 ms
19,680 KB
testcase_34 AC 184 ms
19,680 KB
testcase_35 AC 160 ms
19,680 KB
testcase_36 AC 154 ms
19,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  long long M;
  cin >> N >> M;
  vector<long long> A(N);
  for (int i = 0; i < N; i++){
    cin >> A[i];
  }
  set<long long> st;
  map<long long, int> mp;
  for (int i = 0; i < N; i++){
    long long r = A[i] % M;
    mp[r]++;
    r = min(r, M - r);
    st.insert(r);
  }
  int ans = 0;
  for (long long x : st){
    if (x != 0){
      ans += max(mp[x], mp[M - x]);
    } else {
      ans++;
    }
  }
  cout << ans << endl;
}
0