結果

問題 No.1972 Modulo Set
ユーザー hir355hir355
提出日時 2022-06-10 21:50:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 336 bytes
コンパイル時間 473 ms
コンパイル使用メモリ 81,720 KB
実行使用メモリ 107,312 KB
最終ジャッジ日時 2023-10-21 05:04:54
合計ジャッジ時間 4,793 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,436 KB
testcase_01 AC 43 ms
53,436 KB
testcase_02 AC 43 ms
53,436 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 54 ms
66,452 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 51 ms
66,476 KB
testcase_14 AC 53 ms
68,496 KB
testcase_15 WA -
testcase_16 AC 92 ms
93,524 KB
testcase_17 AC 61 ms
76,380 KB
testcase_18 AC 36 ms
55,484 KB
testcase_19 AC 81 ms
88,720 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 78 ms
87,700 KB
testcase_23 AC 102 ms
102,084 KB
testcase_24 AC 66 ms
83,736 KB
testcase_25 AC 80 ms
93,864 KB
testcase_26 WA -
testcase_27 AC 110 ms
103,712 KB
testcase_28 AC 68 ms
82,172 KB
testcase_29 AC 77 ms
93,308 KB
testcase_30 AC 84 ms
103,696 KB
testcase_31 AC 48 ms
64,428 KB
testcase_32 AC 89 ms
99,524 KB
testcase_33 AC 110 ms
107,312 KB
testcase_34 AC 112 ms
107,312 KB
testcase_35 AC 117 ms
107,312 KB
testcase_36 AC 118 ms
107,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
n, m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(n):
    a[i] %= m
c = Counter(a)
ans = 0
st = set()
for k, v in c.items():
    if k * 2 != m and m - k not in st:
        st.add(k)
        ans += max(v, c[m - k])
if m % 2 == 0 and c[m // 2] > 0:
    ans += 1
print(ans)
0