結果

問題 No.1972 Modulo Set
ユーザー asaringoasaringo
提出日時 2022-06-10 21:39:33
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 982 bytes
コンパイル時間 2,401 ms
コンパイル使用メモリ 213,496 KB
実行使用メモリ 24,268 KB
最終ジャッジ日時 2023-10-21 04:58:10
合計ジャッジ時間 5,810 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 10 ms
4,456 KB
testcase_04 AC 12 ms
4,364 KB
testcase_05 WA -
testcase_06 AC 20 ms
4,828 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 4 ms
4,348 KB
testcase_10 WA -
testcase_11 AC 30 ms
5,248 KB
testcase_12 AC 7 ms
4,348 KB
testcase_13 AC 7 ms
4,568 KB
testcase_14 AC 8 ms
4,624 KB
testcase_15 AC 54 ms
8,040 KB
testcase_16 AC 73 ms
10,180 KB
testcase_17 AC 20 ms
5,756 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 65 ms
10,344 KB
testcase_20 AC 81 ms
11,300 KB
testcase_21 AC 23 ms
5,992 KB
testcase_22 AC 57 ms
10,052 KB
testcase_23 AC 153 ms
20,848 KB
testcase_24 AC 53 ms
10,796 KB
testcase_25 AC 87 ms
14,436 KB
testcase_26 WA -
testcase_27 AC 162 ms
21,928 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 187 ms
24,268 KB
testcase_34 AC 181 ms
24,252 KB
testcase_35 AC 186 ms
24,256 KB
testcase_36 AC 180 ms
24,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std ;
#define fast_input_output ios::sync_with_stdio(false); cin.tie(nullptr);
typedef long long ll ;
typedef long double ld ;
typedef pair<ll,ll> P ;
typedef tuple<ll,ll,ll> TP ;
#define chmin(a,b) a = min(a,b)
#define chmax(a,b) a = max(a,b)
#define bit_count(x) __builtin_popcountll(x)
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) a / gcd(a,b) * b
#define rep(i,n) for(int i = 0 ; i < n ; i++)
#define rrep(i,a,b) for(int i = a ; i < b ; i++)
#define endl "\n"

int n , m ;
ll A[101010] ;
map<ll,ll> mp ;

int main(){
    fast_input_output
    cin >> n >> m ;
    rep(i,n) cin >> A[i] , mp[A[i] % m]++ ;
    int res = 0 ;
    set<ll> st ;
    for(auto it : mp){
        int a = it.first , c = it.second ;
        if(st.count(a) == 1 || st.count(m-a) == 1) continue;
        st.insert(a) ;
        st.insert(m-a) ;
        if(a == 0) continue;
        res += max(mp[m-a],mp[a]) ;
    }
    if(mp[0] > 0) res++ ;
    cout << res << endl ;
}
0