結果

問題 No.1972 Modulo Set
ユーザー rlangevinrlangevin
提出日時 2022-12-30 03:35:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 390 bytes
コンパイル時間 1,774 ms
コンパイル使用メモリ 81,720 KB
実行使用メモリ 109,836 KB
最終ジャッジ日時 2024-05-03 21:14:29
合計ジャッジ時間 6,297 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,248 KB
testcase_01 AC 38 ms
53,248 KB
testcase_02 AC 40 ms
53,248 KB
testcase_03 WA -
testcase_04 AC 61 ms
72,320 KB
testcase_05 WA -
testcase_06 AC 71 ms
80,000 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 53 ms
64,896 KB
testcase_10 WA -
testcase_11 AC 84 ms
88,368 KB
testcase_12 AC 59 ms
67,968 KB
testcase_13 AC 54 ms
65,536 KB
testcase_14 AC 53 ms
65,920 KB
testcase_15 AC 90 ms
92,288 KB
testcase_16 AC 92 ms
96,588 KB
testcase_17 WA -
testcase_18 AC 41 ms
53,760 KB
testcase_19 AC 85 ms
88,960 KB
testcase_20 AC 101 ms
98,944 KB
testcase_21 AC 67 ms
76,160 KB
testcase_22 WA -
testcase_23 AC 121 ms
109,836 KB
testcase_24 AC 78 ms
83,072 KB
testcase_25 AC 94 ms
93,440 KB
testcase_26 WA -
testcase_27 AC 125 ms
109,592 KB
testcase_28 AC 76 ms
83,840 KB
testcase_29 AC 89 ms
92,544 KB
testcase_30 AC 101 ms
104,576 KB
testcase_31 AC 53 ms
65,152 KB
testcase_32 AC 101 ms
100,224 KB
testcase_33 AC 126 ms
102,880 KB
testcase_34 AC 127 ms
102,784 KB
testcase_35 AC 126 ms
102,784 KB
testcase_36 AC 130 ms
102,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *

N, M = map(int, input().split())
A = list(map(int, input().split()))
D = defaultdict(int)

for a in A:
    D[a % M] += 1
    D[M - a % M] += 0
    
ans = 0
for k, v in D.items():
    if k % M == 0 :
        ans += min(1, D[k%M])
    else:
        ans += max(D[k], D[M - k])
    
if M % 2 == 0:
    ans -= D[M//2] * 2
    ans += min(1, D[M//2]) * 2
print(ans // 2)
0