結果

問題 No.1972 Modulo Set
ユーザー monnumonnu
提出日時 2022-06-10 21:37:58
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 549 bytes
コンパイル時間 3,990 ms
コンパイル使用メモリ 235,000 KB
実行使用メモリ 15,008 KB
最終ジャッジ日時 2023-10-21 04:57:18
合計ジャッジ時間 6,790 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 AC 4 ms
4,348 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 6 ms
4,348 KB
testcase_14 AC 6 ms
4,348 KB
testcase_15 WA -
testcase_16 AC 67 ms
7,072 KB
testcase_17 AC 22 ms
4,756 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 53 ms
7,244 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 48 ms
7,120 KB
testcase_23 AC 117 ms
13,116 KB
testcase_24 AC 43 ms
7,612 KB
testcase_25 AC 67 ms
9,612 KB
testcase_26 WA -
testcase_27 AC 116 ms
13,724 KB
testcase_28 AC 39 ms
7,784 KB
testcase_29 AC 60 ms
9,828 KB
testcase_30 AC 85 ms
12,084 KB
testcase_31 AC 5 ms
4,348 KB
testcase_32 AC 78 ms
11,312 KB
testcase_33 AC 142 ms
15,008 KB
testcase_34 AC 137 ms
15,000 KB
testcase_35 AC 130 ms
15,004 KB
testcase_36 AC 129 ms
15,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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 500

int 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';
}
0