結果

問題 No.1972 Modulo Set
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2022-06-11 02:18:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 771 bytes
コンパイル時間 1,800 ms
コンパイル使用メモリ 174,620 KB
実行使用メモリ 9,540 KB
最終ジャッジ日時 2023-10-21 08:32:31
合計ジャッジ時間 10,815 ms
ジャッジサーバーID
(参考情報)
judge14 / 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 WA -
testcase_04 AC 32 ms
4,348 KB
testcase_05 WA -
testcase_06 AC 56 ms
4,348 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 13 ms
4,348 KB
testcase_10 WA -
testcase_11 AC 77 ms
4,348 KB
testcase_12 AC 22 ms
4,348 KB
testcase_13 AC 26 ms
4,348 KB
testcase_14 AC 28 ms
4,348 KB
testcase_15 AC 159 ms
5,528 KB
testcase_16 AC 224 ms
6,236 KB
testcase_17 WA -
testcase_18 AC 3 ms
4,348 KB
testcase_19 AC 212 ms
6,052 KB
testcase_20 AC 253 ms
6,516 KB
testcase_21 AC 81 ms
4,596 KB
testcase_22 WA -
testcase_23 AC 521 ms
8,640 KB
testcase_24 AC 204 ms
5,608 KB
testcase_25 AC 314 ms
6,656 KB
testcase_26 WA -
testcase_27 AC 546 ms
8,868 KB
testcase_28 AC 213 ms
5,644 KB
testcase_29 AC 320 ms
6,668 KB
testcase_30 AC 439 ms
7,796 KB
testcase_31 AC 25 ms
4,348 KB
testcase_32 AC 408 ms
7,408 KB
testcase_33 AC 611 ms
9,540 KB
testcase_34 AC 618 ms
9,536 KB
testcase_35 AC 620 ms
9,536 KB
testcase_36 AC 612 ms
9,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2022.06.11 02:18:44
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;


int main() {
    int n;cin >> n;
    ll m;cin >> m;
    map<ll,int> mp;
    for (int i = 0; i < n; i++) {
        ll a;cin >> a;
        mp[a%m]++;
    }
    int ans = 0;
    for (auto p : mp) {
        if (p.first == 0) continue;
        if (mp.find(m-p.first) != mp.end()) {
            if (p.first>=m-p.first) continue;
            ans += max(p.second,mp[m-p.first]);
        }
        else {
            ans += p.second;
        }
        cerr << ans << " " << p.first << endl;
    }
    if (mp.find(0) != mp.end()) ans++;
    if (m%2==0&&mp.find(m)!=mp.end()) ans++;
    cout << ans << endl;
    return 0;
}
0