結果

問題 No.1972 Modulo Set
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2022-06-11 02:20:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 631 ms / 2,000 ms
コード長 773 bytes
コンパイル時間 1,949 ms
コンパイル使用メモリ 170,560 KB
実行使用メモリ 9,600 KB
最終ジャッジ日時 2024-04-15 08:57:24
合計ジャッジ時間 10,927 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 30 ms
5,376 KB
testcase_04 AC 33 ms
5,376 KB
testcase_05 AC 30 ms
5,376 KB
testcase_06 AC 57 ms
5,376 KB
testcase_07 AC 81 ms
5,376 KB
testcase_08 AC 29 ms
5,376 KB
testcase_09 AC 14 ms
5,376 KB
testcase_10 AC 29 ms
5,376 KB
testcase_11 AC 81 ms
5,376 KB
testcase_12 AC 24 ms
5,376 KB
testcase_13 AC 28 ms
5,376 KB
testcase_14 AC 29 ms
5,376 KB
testcase_15 AC 164 ms
5,504 KB
testcase_16 AC 247 ms
6,272 KB
testcase_17 AC 75 ms
5,376 KB
testcase_18 AC 3 ms
5,376 KB
testcase_19 AC 220 ms
6,016 KB
testcase_20 AC 257 ms
6,400 KB
testcase_21 AC 82 ms
5,376 KB
testcase_22 AC 201 ms
5,632 KB
testcase_23 AC 531 ms
8,576 KB
testcase_24 AC 211 ms
5,632 KB
testcase_25 AC 320 ms
6,784 KB
testcase_26 AC 212 ms
6,016 KB
testcase_27 AC 553 ms
8,832 KB
testcase_28 AC 217 ms
5,760 KB
testcase_29 AC 326 ms
6,784 KB
testcase_30 AC 449 ms
7,936 KB
testcase_31 AC 24 ms
5,376 KB
testcase_32 AC 420 ms
7,552 KB
testcase_33 AC 631 ms
9,600 KB
testcase_34 AC 623 ms
9,600 KB
testcase_35 AC 624 ms
9,600 KB
testcase_36 AC 629 ms
9,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2022.06.11 02:20:52
**/

#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/2)!=mp.end()) ans++;
    cout << ans << endl;
    return 0;
}
0