結果

問題 No.1972 Modulo Set
ユーザー lilictakalilictaka
提出日時 2022-06-12 01:51:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 420 bytes
コンパイル時間 420 ms
コンパイル使用メモリ 81,796 KB
実行使用メモリ 125,672 KB
最終ジャッジ日時 2023-10-23 18:16:51
合計ジャッジ時間 8,130 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
53,544 KB
testcase_01 AC 43 ms
53,544 KB
testcase_02 AC 43 ms
53,544 KB
testcase_03 AC 68 ms
73,468 KB
testcase_04 AC 66 ms
73,276 KB
testcase_05 WA -
testcase_06 AC 78 ms
81,592 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 62 ms
66,604 KB
testcase_10 WA -
testcase_11 AC 91 ms
88,288 KB
testcase_12 AC 64 ms
70,992 KB
testcase_13 AC 57 ms
66,856 KB
testcase_14 AC 62 ms
68,940 KB
testcase_15 AC 103 ms
91,768 KB
testcase_16 AC 109 ms
94,144 KB
testcase_17 AC 74 ms
78,100 KB
testcase_18 AC 45 ms
55,604 KB
testcase_19 AC 105 ms
89,920 KB
testcase_20 AC 114 ms
95,656 KB
testcase_21 AC 75 ms
80,312 KB
testcase_22 AC 96 ms
97,080 KB
testcase_23 AC 156 ms
115,348 KB
testcase_24 AC 89 ms
94,764 KB
testcase_25 AC 122 ms
109,432 KB
testcase_26 WA -
testcase_27 AC 169 ms
115,412 KB
testcase_28 AC 89 ms
94,960 KB
testcase_29 AC 108 ms
108,504 KB
testcase_30 AC 135 ms
125,672 KB
testcase_31 AC 56 ms
66,584 KB
testcase_32 AC 128 ms
119,096 KB
testcase_33 AC 191 ms
123,976 KB
testcase_34 AC 176 ms
123,964 KB
testcase_35 AC 179 ms
123,964 KB
testcase_36 AC 182 ms
123,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
N,M = map(int,input().split())
A = list(map(int,input().split()))
seen = defaultdict(bool)
cnt = defaultdict(int)
ans = 0
for a in A:
    cnt[a%M] += 1
keys = list(cnt.keys())
for key in keys:
    if key == 0:
        ans += 1
        continue
    if seen[key]:
        continue
    inv = M - key
    ans += max(cnt[key],cnt[inv])
    seen[key] = True
    seen[inv] = True
print(ans)
0