結果

問題 No.1972 Modulo Set
ユーザー 👑 NachiaNachia
提出日時 2022-06-10 21:23:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 896 bytes
コンパイル時間 1,556 ms
コンパイル使用メモリ 91,564 KB
実行使用メモリ 9,180 KB
最終ジャッジ日時 2023-10-21 04:48:25
合計ジャッジ時間 3,601 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 7 ms
4,348 KB
testcase_04 AC 10 ms
4,348 KB
testcase_05 WA -
testcase_06 AC 17 ms
4,348 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 3 ms
4,348 KB
testcase_10 WA -
testcase_11 AC 25 ms
4,348 KB
testcase_12 AC 5 ms
4,348 KB
testcase_13 AC 4 ms
4,348 KB
testcase_14 AC 4 ms
4,348 KB
testcase_15 AC 29 ms
4,600 KB
testcase_16 AC 35 ms
5,212 KB
testcase_17 AC 11 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 28 ms
5,300 KB
testcase_20 AC 37 ms
5,536 KB
testcase_21 AC 13 ms
4,348 KB
testcase_22 AC 24 ms
5,236 KB
testcase_23 AC 65 ms
8,236 KB
testcase_24 AC 20 ms
5,480 KB
testcase_25 AC 35 ms
6,484 KB
testcase_26 WA -
testcase_27 AC 70 ms
8,536 KB
testcase_28 AC 20 ms
5,568 KB
testcase_29 AC 34 ms
6,592 KB
testcase_30 AC 54 ms
7,720 KB
testcase_31 AC 4 ms
4,348 KB
testcase_32 AC 45 ms
7,332 KB
testcase_33 AC 81 ms
9,180 KB
testcase_34 AC 82 ms
9,176 KB
testcase_35 AC 80 ms
9,180 KB
testcase_36 AC 83 ms
9,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <atcoder/modint>
using namespace std;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
#define rep(i,n) for(int i=0; i<(int)(n); i++)


const i64 INF = 1001001001001001001;
using modint = atcoder::static_modint<1000000007>;


int main(){
    int N; cin >> N;
    i64 M; cin >> M;
    map<i64, pair<int,int>> A;
    int t = 0;
    rep(i,N){
        i64 a; cin >> a;
        a %= M;
        if(a == 0) t = 1;
        else{
            if(M-a < a) A[a].first++; else A[M-a].second++;
        }
    }
    for(auto a : A) t += max(a.second.first, a.second.second);
    cout << t << endl;
    return 0;
}


struct ios_do_not_sync{
    ios_do_not_sync(){
        std::ios::sync_with_stdio(false);
        std::cin.tie(nullptr);
    }
} ios_do_not_sync_instance;


0