結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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,484 KB
testcase_04 AC 11 ms
4,392 KB
testcase_05 AC 12 ms
4,348 KB
testcase_06 AC 21 ms
4,856 KB
testcase_07 AC 30 ms
5,204 KB
testcase_08 AC 12 ms
4,348 KB
testcase_09 AC 4 ms
4,348 KB
testcase_10 AC 11 ms
4,348 KB
testcase_11 AC 29 ms
5,276 KB
testcase_12 AC 7 ms
4,348 KB
testcase_13 AC 7 ms
4,596 KB
testcase_14 AC 7 ms
4,652 KB
testcase_15 AC 51 ms
8,068 KB
testcase_16 AC 73 ms
10,208 KB
testcase_17 AC 20 ms
5,784 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 62 ms
10,372 KB
testcase_20 AC 76 ms
11,328 KB
testcase_21 AC 22 ms
6,020 KB
testcase_22 AC 58 ms
10,080 KB
testcase_23 AC 152 ms
20,876 KB
testcase_24 AC 54 ms
10,824 KB
testcase_25 AC 85 ms
14,464 KB
testcase_26 AC 67 ms
9,148 KB
testcase_27 AC 152 ms
21,956 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 178 ms
24,296 KB
testcase_34 AC 175 ms
24,280 KB
testcase_35 AC 186 ms
24,284 KB
testcase_36 AC 186 ms
24,288 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) res++ ;
        else if(a + a == m) res++ ;
        else res += max(mp[m-a],mp[a]) ;
    }
    cout << res << endl ;
}
0