結果

問題 No.1972 Modulo Set
ユーザー mnmmnm
提出日時 2022-06-12 10:56:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 673 bytes
コンパイル時間 752 ms
コンパイル使用メモリ 78,388 KB
実行使用メモリ 11,036 KB
最終ジャッジ日時 2023-10-24 04:23:23
合計ジャッジ時間 5,061 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 11 ms
4,348 KB
testcase_04 AC 16 ms
4,348 KB
testcase_05 AC 19 ms
4,348 KB
testcase_06 AC 28 ms
4,348 KB
testcase_07 AC 42 ms
4,348 KB
testcase_08 AC 22 ms
4,348 KB
testcase_09 AC 3 ms
4,348 KB
testcase_10 AC 16 ms
4,348 KB
testcase_11 AC 41 ms
4,348 KB
testcase_12 AC 7 ms
4,348 KB
testcase_13 AC 4 ms
4,348 KB
testcase_14 AC 5 ms
4,348 KB
testcase_15 AC 38 ms
4,348 KB
testcase_16 AC 39 ms
4,348 KB
testcase_17 AC 15 ms
4,348 KB
testcase_18 AC 1 ms
4,348 KB
testcase_19 AC 31 ms
4,348 KB
testcase_20 AC 38 ms
4,348 KB
testcase_21 AC 19 ms
4,348 KB
testcase_22 AC 26 ms
4,348 KB
testcase_23 AC 51 ms
8,232 KB
testcase_24 AC 22 ms
8,232 KB
testcase_25 AC 30 ms
9,220 KB
testcase_26 AC 51 ms
4,348 KB
testcase_27 AC 52 ms
10,276 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 AC 63 ms
11,036 KB
testcase_34 AC 57 ms
11,036 KB
testcase_35 AC 58 ms
11,036 KB
testcase_36 AC 61 ms
11,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <tuple>
#include <bitset>

#define rep(i,n) for(i=0; i<n; ++i)
#define in(a) cin >> a
#define out(a,b) cout << a << b
using namespace std;
using lint = long long;

int main(void){
    lint i, j;
    lint n, m;
    in(n);
    in(m);
    vector<lint> rem(m,0);
    rep(i,n){
        lint num;
        in(num);
        rem[num%m]++;
    }
    lint cnt=0;
    if(rem[0]!=0)   cnt++;
    for(i=1; i<(m/2+m%2); ++i){
        lint elem=max(rem[i],rem[m-i]);
        cnt+=elem;
    }
    if(m%2==0&&rem[m/2]!=0) cnt++;
    if(cnt<1)   cnt=1;
    out(cnt,endl);

    return 0;
}
0