結果

問題 No.1972 Modulo Set
ユーザー monnumonnu
提出日時 2022-06-10 21:40:17
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 194 ms / 2,000 ms
コード長 553 bytes
コンパイル時間 4,600 ms
コンパイル使用メモリ 229,472 KB
実行使用メモリ 15,104 KB
最終ジャッジ日時 2024-04-15 08:48:52
合計ジャッジ時間 8,509 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 15 ms
5,376 KB
testcase_04 AC 21 ms
5,376 KB
testcase_05 AC 25 ms
5,376 KB
testcase_06 AC 39 ms
5,376 KB
testcase_07 AC 58 ms
5,376 KB
testcase_08 AC 27 ms
5,376 KB
testcase_09 AC 4 ms
5,376 KB
testcase_10 AC 22 ms
5,376 KB
testcase_11 AC 62 ms
5,376 KB
testcase_12 AC 11 ms
5,376 KB
testcase_13 AC 7 ms
5,376 KB
testcase_14 AC 8 ms
5,376 KB
testcase_15 AC 79 ms
5,888 KB
testcase_16 AC 88 ms
6,912 KB
testcase_17 AC 26 ms
5,376 KB
testcase_18 AC 3 ms
5,376 KB
testcase_19 AC 75 ms
7,168 KB
testcase_20 AC 92 ms
7,552 KB
testcase_21 AC 32 ms
5,376 KB
testcase_22 AC 71 ms
7,168 KB
testcase_23 AC 155 ms
12,928 KB
testcase_24 AC 50 ms
7,424 KB
testcase_25 AC 84 ms
9,472 KB
testcase_26 AC 103 ms
6,400 KB
testcase_27 AC 160 ms
13,568 KB
testcase_28 AC 53 ms
7,552 KB
testcase_29 AC 88 ms
9,856 KB
testcase_30 AC 121 ms
11,904 KB
testcase_31 AC 6 ms
5,376 KB
testcase_32 AC 110 ms
11,136 KB
testcase_33 AC 184 ms
15,104 KB
testcase_34 AC 183 ms
14,848 KB
testcase_35 AC 194 ms
15,104 KB
testcase_36 AC 186 ms
15,104 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==0&&p.second>0){
      ans++;
    }else{
      if(p.second>=m[M-p.first]){
        ans+=p.second;
        m[M-p.first]=0;
      }
    }
  }
  cout<<ans<<'\n';
}
0