結果

問題 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,143 ms
コンパイル使用メモリ 207,976 KB
実行使用メモリ 26,088 KB
最終ジャッジ日時 2023-08-28 08:46:19
合計ジャッジ時間 7,651 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 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,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 6 ms
4,376 KB
testcase_14 AC 8 ms
4,436 KB
testcase_15 WA -
testcase_16 AC 68 ms
10,228 KB
testcase_17 AC 19 ms
5,508 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 60 ms
10,656 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 51 ms
10,320 KB
testcase_23 AC 138 ms
22,308 KB
testcase_24 AC 53 ms
11,272 KB
testcase_25 AC 86 ms
15,292 KB
testcase_26 WA -
testcase_27 AC 150 ms
23,456 KB
testcase_28 AC 58 ms
11,688 KB
testcase_29 AC 96 ms
15,776 KB
testcase_30 AC 135 ms
20,180 KB
testcase_31 AC 6 ms
4,376 KB
testcase_32 AC 122 ms
18,688 KB
testcase_33 AC 175 ms
26,088 KB
testcase_34 AC 173 ms
25,984 KB
testcase_35 AC 179 ms
26,000 KB
testcase_36 AC 173 ms
25,984 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