結果

問題 No.1972 Modulo Set
ユーザー mnmmnm
提出日時 2022-06-12 01:58:01
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 709 bytes
コンパイル時間 873 ms
コンパイル使用メモリ 78,288 KB
実行使用メモリ 11,060 KB
最終ジャッジ日時 2023-10-23 18:23:43
合計ジャッジ時間 4,137 ms
ジャッジサーバーID
(参考情報)
judge14 / 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 AC 11 ms
4,348 KB
testcase_04 AC 16 ms
4,348 KB
testcase_05 WA -
testcase_06 AC 28 ms
4,348 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 3 ms
4,348 KB
testcase_10 WA -
testcase_11 AC 41 ms
4,348 KB
testcase_12 AC 7 ms
4,348 KB
testcase_13 AC 5 ms
4,348 KB
testcase_14 AC 4 ms
4,348 KB
testcase_15 AC 40 ms
4,348 KB
testcase_16 AC 40 ms
4,348 KB
testcase_17 AC 16 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 31 ms
4,348 KB
testcase_20 AC 40 ms
4,348 KB
testcase_21 AC 19 ms
4,348 KB
testcase_22 AC 27 ms
4,348 KB
testcase_23 AC 56 ms
8,260 KB
testcase_24 AC 26 ms
8,260 KB
testcase_25 AC 35 ms
9,248 KB
testcase_26 WA -
testcase_27 AC 59 ms
10,304 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 AC 67 ms
11,060 KB
testcase_34 AC 66 ms
11,060 KB
testcase_35 AC 65 ms
11,060 KB
testcase_36 AC 68 ms
11,060 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-1)/2)+1; ++i){
        lint max;
        rem[i]>rem[m-i]? max=rem[i]: max=rem[m-i];
        cnt+=max;
    }
    if((m-1)%2==1)  cnt+=rem[(m-1)/2+1];
    if(cnt<1)   cnt=1;
    out(cnt,endl);

    return 0;
}
0