結果

問題 No.1972 Modulo Set
ユーザー rogi52rogi52
提出日時 2022-10-04 02:51:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 519 bytes
コンパイル時間 2,080 ms
コンパイル使用メモリ 208,424 KB
実行使用メモリ 26,184 KB
最終ジャッジ日時 2023-08-28 08:46:26
合計ジャッジ時間 5,802 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 4 ms
4,380 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 7 ms
4,408 KB
testcase_14 AC 7 ms
4,384 KB
testcase_15 WA -
testcase_16 AC 65 ms
10,204 KB
testcase_17 AC 19 ms
5,492 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 61 ms
10,624 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 55 ms
10,300 KB
testcase_23 AC 145 ms
22,368 KB
testcase_24 AC 52 ms
11,268 KB
testcase_25 AC 83 ms
15,288 KB
testcase_26 WA -
testcase_27 AC 153 ms
23,452 KB
testcase_28 AC 56 ms
11,732 KB
testcase_29 AC 95 ms
15,816 KB
testcase_30 AC 133 ms
20,288 KB
testcase_31 AC 6 ms
4,444 KB
testcase_32 AC 123 ms
18,804 KB
testcase_33 AC 174 ms
25,992 KB
testcase_34 AC 174 ms
26,112 KB
testcase_35 AC 178 ms
26,016 KB
testcase_36 AC 176 ms
26,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    ll N,M; cin >> N >> M;
    map<ll,ll> mp;
    rep(i,N) {
        ll a; cin >> a;
        mp[a % M]++;
    }

    ll ans = 0;
    map<ll,ll> visited;
    for(auto [x, _] : mp) {
        if(visited.count(x)) continue;
        visited[x] = 1;
        visited[M - x] = 1;
        ans += max(mp[x], mp[M - x]);
    }
    cout << ans << endl;
}
0