結果

問題 No.1972 Modulo Set
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-06-11 09:50:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 172 ms / 2,000 ms
コード長 437 bytes
コンパイル時間 316 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 115,840 KB
最終ジャッジ日時 2024-04-15 08:58:02
合計ジャッジ時間 5,612 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
53,632 KB
testcase_01 AC 46 ms
53,248 KB
testcase_02 AC 46 ms
53,632 KB
testcase_03 AC 73 ms
71,296 KB
testcase_04 AC 76 ms
73,088 KB
testcase_05 AC 73 ms
74,336 KB
testcase_06 AC 85 ms
81,152 KB
testcase_07 AC 102 ms
90,496 KB
testcase_08 AC 66 ms
73,572 KB
testcase_09 AC 67 ms
66,176 KB
testcase_10 AC 70 ms
73,216 KB
testcase_11 AC 94 ms
88,880 KB
testcase_12 AC 67 ms
69,444 KB
testcase_13 AC 63 ms
66,176 KB
testcase_14 AC 71 ms
67,712 KB
testcase_15 AC 106 ms
92,544 KB
testcase_16 AC 116 ms
94,976 KB
testcase_17 AC 87 ms
76,800 KB
testcase_18 AC 45 ms
54,016 KB
testcase_19 AC 107 ms
90,880 KB
testcase_20 AC 114 ms
96,472 KB
testcase_21 AC 85 ms
78,848 KB
testcase_22 AC 98 ms
92,604 KB
testcase_23 AC 151 ms
105,368 KB
testcase_24 AC 93 ms
88,528 KB
testcase_25 AC 123 ms
102,400 KB
testcase_26 AC 116 ms
97,132 KB
testcase_27 AC 153 ms
105,628 KB
testcase_28 AC 93 ms
89,216 KB
testcase_29 AC 111 ms
101,120 KB
testcase_30 AC 137 ms
115,840 KB
testcase_31 AC 63 ms
65,408 KB
testcase_32 AC 128 ms
110,592 KB
testcase_33 AC 166 ms
109,996 KB
testcase_34 AC 170 ms
110,240 KB
testcase_35 AC 168 ms
109,988 KB
testcase_36 AC 172 ms
110,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
a = list(map(int,input().split()))
from collections import defaultdict
m_d = defaultdict(int)
for i in range(n):
    m_d[a[i]%m] += 1

ans = 0
if m_d[0]:ans += 1
if not (m&1) and m_d[m//2]:ans +=1
memo = set()
for key in list(m_d.keys())[::]:
    if key == 0:continue
    if not (m&1) and key ==  m//2:continue
    if key in memo:continue
    ans += max(m_d[key], m_d[m-key])
    memo.add(m-key)
print(ans)
0