結果

問題 No.1972 Modulo Set
ユーザー mnmmnm
提出日時 2022-08-07 11:06:50
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,469 bytes
コンパイル時間 821 ms
コンパイル使用メモリ 89,800 KB
実行使用メモリ 7,768 KB
最終ジャッジ日時 2023-10-17 06:55:43
合計ジャッジ時間 8,266 ms
ジャッジサーバーID
(参考情報)
judge13 / 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 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 2 ms
4,348 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 TLE -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <tuple>
#include <bitset>
#include <map>

#define rep(i,n) for(i=0; i<n; ++i)
#define inc_rep(i,a,n) for(i=a; i<=n; ++i)
#define dec_rep(i,n,a) for(i=n; i>=a; --i)
#define in(a) cin >> a
#define out(a,b) cout << a << b
#define print_vec(v) for(auto it=v.begin();it!=v.end();++it)cout<<*it <<" ";cout<<endl
#define print_vec2d(v) for(int i=0;i<v.size();++i){for(int j=0;j<v[i].size();++j)cout<<v[i][j]<<" ";cout<<endl;}cout<<endl
using namespace std;
using lint = long long;


int main(void){ 
    int i, j, k, cnt=0, x, y;
    lint p, q, n, m;
    string s;
    map<int, int> d;
    in(n); in(m);
    rep(i,n){
        in(k);
        d[k%m]++;
        cnt++;
    }
    lint sum=0;
    auto it = d.find(0);
    if(it!=d.end()){
        sum++;
    }
    rep(i,(m+2)/2){
        if(i==0) continue;
        j=m-i;
        if(i==j){
            it = d.find(i);
            if(it!=d.end()){
                sum++;
            }
        }
        else{
            lint l, r;
            auto itl = d.find(i);
            auto itr = d.find(j);
            if(itl!=d.end()){
                l = d[i];
            }
            else{
                l = 0;
            }
            if(itr!=d.end()){
                r = d[j];
            }
            else{
                r = 0;
            }
            sum+=max(l,r);
        }
    }
    out(sum, endl);
    return 0;
}
0