結果

問題 No.1972 Modulo Set
ユーザー keisuke6keisuke6
提出日時 2022-06-10 21:56:35
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 504 bytes
コンパイル時間 3,148 ms
コンパイル使用メモリ 253,720 KB
実行使用メモリ 10,236 KB
最終ジャッジ日時 2023-10-21 05:07:48
合計ジャッジ時間 8,448 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 RE -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 2 ms
4,348 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 WA -
testcase_27 RE -
testcase_28 AC 40 ms
5,776 KB
testcase_29 AC 65 ms
6,800 KB
testcase_30 AC 96 ms
8,116 KB
testcase_31 AC 6 ms
4,348 KB
testcase_32 AC 88 ms
7,588 KB
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int N,M;
  cin>>N>>M;
  vector<int> S(N);
  map<int,int> s;
  for(int i=0;i<N;i++){
      cin>>S[i];
      S[i] %= M;
      if(!s.count(S[i])) s[S[i]] = 0;
      s[S[i]]++;
  }
  int ans = 0;
  for(auto x:s){
      int a = x.first;
      int b = x.second;
      if(a == 0) ans++;
      else if(!s.count(M-a)) ans += b;
      else if(a == M-a) ans++;
      else if(a < M-a) ans += max(S[M-a],b);
  }
  cout<<ans<<endl;
}
0