結果

問題 No.1972 Modulo Set
ユーザー umimelumimel
提出日時 2022-06-10 21:30:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 775 bytes
コンパイル時間 1,783 ms
コンパイル使用メモリ 176,324 KB
実行使用メモリ 15,476 KB
最終ジャッジ日時 2023-10-21 04:52:52
合計ジャッジ時間 4,869 ms
ジャッジサーバーID
(参考情報)
judge9 / 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 AC 13 ms
4,348 KB
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 7 ms
4,348 KB
testcase_15 WA -
testcase_16 AC 68 ms
7,292 KB
testcase_17 WA -
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 57 ms
7,292 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 117 ms
13,364 KB
testcase_24 AC 45 ms
7,612 KB
testcase_25 AC 71 ms
9,668 KB
testcase_26 WA -
testcase_27 AC 129 ms
14,156 KB
testcase_28 AC 42 ms
7,820 KB
testcase_29 AC 63 ms
9,932 KB
testcase_30 AC 88 ms
12,308 KB
testcase_31 AC 6 ms
4,348 KB
testcase_32 AC 81 ms
11,516 KB
testcase_33 AC 135 ms
15,476 KB
testcase_34 AC 132 ms
15,476 KB
testcase_35 AC 140 ms
15,476 KB
testcase_36 AC 138 ms
15,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
#define drep(i, cc, n) for (ll i = (cc); i <= (n); ++i)
#define rep(i, n) drep(i, 0, n - 1)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define fi first
#define se second

const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll INF = 1LL << 60;
const ll N_MAX = 2e5;

int main(){
    ll n, m;
    cin >> n >> m;

    vector<ll> a(n);
    rep(i, n) cin >> a[i];

    map<ll, ll> mp;
    rep(i, n) mp[a[i]%m]++;

    ll ans = 0;
    for(auto itr=mp.begin(); itr!=mp.end(); itr++){
        if((*itr).fi*2 == m) continue;
        ans += max((*itr).se, mp[(m-(*itr).fi)%m]);
        (*itr).se = 0;
        mp[(m-(*itr).fi)%m] = 0;
    }

    cout << ans << endl;
}
0