結果

問題 No.1972 Modulo Set
ユーザー erbowlerbowl
提出日時 2022-08-07 20:12:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 625 bytes
コンパイル時間 5,578 ms
コンパイル使用メモリ 215,240 KB
実行使用メモリ 26,264 KB
最終ジャッジ日時 2023-10-17 14:47:53
合計ジャッジ時間 9,852 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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,364 KB
testcase_04 AC 20 ms
4,348 KB
testcase_05 WA -
testcase_06 AC 37 ms
4,472 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 5 ms
4,348 KB
testcase_10 WA -
testcase_11 AC 56 ms
4,704 KB
testcase_12 AC 11 ms
4,348 KB
testcase_13 AC 8 ms
4,608 KB
testcase_14 AC 9 ms
4,664 KB
testcase_15 AC 74 ms
7,952 KB
testcase_16 AC 91 ms
10,396 KB
testcase_17 AC 29 ms
5,764 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 78 ms
10,740 KB
testcase_20 AC 99 ms
11,696 KB
testcase_21 AC 34 ms
5,968 KB
testcase_22 AC 66 ms
10,488 KB
testcase_23 AC 174 ms
22,480 KB
testcase_24 AC 62 ms
11,472 KB
testcase_25 AC 99 ms
15,472 KB
testcase_26 WA -
testcase_27 AC 181 ms
23,696 KB
testcase_28 AC 65 ms
11,820 KB
testcase_29 AC 109 ms
15,904 KB
testcase_30 AC 152 ms
20,416 KB
testcase_31 AC 8 ms
4,516 KB
testcase_32 AC 138 ms
18,876 KB
testcase_33 AC 204 ms
26,264 KB
testcase_34 AC 204 ms
26,248 KB
testcase_35 AC 210 ms
26,256 KB
testcase_36 AC 206 ms
26,260 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==0){
            ans++;
        }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