結果

問題 No.1972 Modulo Set
ユーザー erbowlerbowl
提出日時 2022-08-07 20:15:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 217 ms / 2,000 ms
コード長 658 bytes
コンパイル時間 2,642 ms
コンパイル使用メモリ 216,276 KB
実行使用メモリ 26,168 KB
最終ジャッジ日時 2023-10-17 14:50:34
合計ジャッジ時間 7,483 ms
ジャッジサーバーID
(参考情報)
judge11 / 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 15 ms
4,348 KB
testcase_04 AC 21 ms
4,348 KB
testcase_05 AC 24 ms
4,348 KB
testcase_06 AC 38 ms
4,376 KB
testcase_07 AC 57 ms
4,500 KB
testcase_08 AC 25 ms
4,348 KB
testcase_09 AC 5 ms
4,348 KB
testcase_10 AC 21 ms
4,348 KB
testcase_11 AC 56 ms
4,608 KB
testcase_12 AC 11 ms
4,348 KB
testcase_13 AC 8 ms
4,512 KB
testcase_14 AC 9 ms
4,568 KB
testcase_15 AC 73 ms
7,856 KB
testcase_16 AC 93 ms
10,300 KB
testcase_17 AC 29 ms
5,668 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 79 ms
10,644 KB
testcase_20 AC 97 ms
11,600 KB
testcase_21 AC 34 ms
5,872 KB
testcase_22 AC 70 ms
10,392 KB
testcase_23 AC 171 ms
22,384 KB
testcase_24 AC 62 ms
11,376 KB
testcase_25 AC 100 ms
15,376 KB
testcase_26 AC 100 ms
8,868 KB
testcase_27 AC 180 ms
23,600 KB
testcase_28 AC 68 ms
11,724 KB
testcase_29 AC 109 ms
15,808 KB
testcase_30 AC 156 ms
20,320 KB
testcase_31 AC 8 ms
4,420 KB
testcase_32 AC 140 ms
18,780 KB
testcase_33 AC 211 ms
26,168 KB
testcase_34 AC 209 ms
26,152 KB
testcase_35 AC 208 ms
26,160 KB
testcase_36 AC 217 ms
26,164 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

typedef long long ll;
typedef long double ld;
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
    ll n,m;
    std::cin >> n>>m;
    map<ll,ll> used;
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        ll a;
        std::cin >> a;
        used[a%m]++;
    }
    map<ll,bool> u;
    for (auto e : used) {
        if(e.first*2%m==0){
            ans++;
            u[e.first]=true;
        }else{
            if(!u[e.first]){
                ans += max(used[e.first],used[m-e.first]);
                u[e.first]=true;
                u[m-e.first]=true;
            }
        }
    }
    std::cout << ans << std::endl;
}
0