結果

問題 No.1972 Modulo Set
ユーザー AngrySadEightAngrySadEight
提出日時 2022-06-10 21:36:03
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 753 bytes
コンパイル時間 3,585 ms
コンパイル使用メモリ 237,008 KB
実行使用メモリ 534,284 KB
最終ジャッジ日時 2023-10-21 04:55:21
合計ジャッジ時間 9,893 ms
ジャッジサーバーID
(参考情報)
judge13 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 13 ms
4,348 KB
testcase_04 AC 20 ms
4,348 KB
testcase_05 AC 21 ms
4,348 KB
testcase_06 AC 33 ms
4,348 KB
testcase_07 AC 52 ms
4,424 KB
testcase_08 AC 25 ms
4,348 KB
testcase_09 AC 4 ms
4,348 KB
testcase_10 AC 18 ms
4,348 KB
testcase_11 AC 48 ms
4,424 KB
testcase_12 AC 9 ms
4,348 KB
testcase_13 AC 14 ms
6,696 KB
testcase_14 AC 12 ms
6,016 KB
testcase_15 AC 55 ms
6,272 KB
testcase_16 AC 62 ms
7,592 KB
testcase_17 AC 22 ms
4,852 KB
testcase_18 AC 3 ms
4,348 KB
testcase_19 AC 55 ms
8,384 KB
testcase_20 AC 64 ms
8,648 KB
testcase_21 AC 26 ms
4,952 KB
testcase_22 AC 48 ms
8,648 KB
testcase_23 AC 240 ms
42,968 KB
testcase_24 AC 189 ms
42,832 KB
testcase_25 AC 248 ms
50,920 KB
testcase_26 AC 71 ms
6,800 KB
testcase_27 AC 311 ms
59,336 KB
testcase_28 MLE -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(), v.end()
#define mod1 1000000007
#define mod2 998244353
typedef long long ll;

int main(){
    ll N, M;
    cin >> N >> M;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];
    map<ll,ll> mp;
    for (ll i = 0; i < N; i++){
        mp[A[i] % M]++;
    }
    ll ans = 0;
    for (ll i = 1; i < M / 2; i++){
        ans += max(mp[i], mp[M - i]);
    }
    ans += min(1LL, mp[0]);
    if (M % 2 == 0){
        ans += min(1LL, mp[M / 2]);
    }
    else{
        ans += max(mp[M / 2], mp[M - M / 2]);
    }
    cout << ans << endl;
}
0