結果

問題 No.1972 Modulo Set
ユーザー ntudantuda
提出日時 2022-10-13 22:38:19
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 379 bytes
コンパイル時間 260 ms
コンパイル使用メモリ 86,944 KB
実行使用メモリ 100,240 KB
最終ジャッジ日時 2023-09-08 19:16:29
合計ジャッジ時間 8,113 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,408 KB
testcase_01 AC 71 ms
71,216 KB
testcase_02 AC 73 ms
71,348 KB
testcase_03 AC 82 ms
77,268 KB
testcase_04 AC 85 ms
79,128 KB
testcase_05 AC 81 ms
80,172 KB
testcase_06 AC 86 ms
84,020 KB
testcase_07 AC 95 ms
89,916 KB
testcase_08 AC 83 ms
81,804 KB
testcase_09 AC 77 ms
76,304 KB
testcase_10 AC 81 ms
79,480 KB
testcase_11 AC 94 ms
88,660 KB
testcase_12 AC 78 ms
76,848 KB
testcase_13 AC 77 ms
76,776 KB
testcase_14 AC 76 ms
76,636 KB
testcase_15 AC 95 ms
88,452 KB
testcase_16 AC 95 ms
88,540 KB
testcase_17 AC 83 ms
79,304 KB
testcase_18 AC 74 ms
75,836 KB
testcase_19 AC 89 ms
84,936 KB
testcase_20 AC 94 ms
88,780 KB
testcase_21 AC 84 ms
80,360 KB
testcase_22 AC 88 ms
83,392 KB
testcase_23 AC 99 ms
94,760 KB
testcase_24 AC 85 ms
85,176 KB
testcase_25 AC 94 ms
88,732 KB
testcase_26 AC 100 ms
92,584 KB
testcase_27 AC 109 ms
97,212 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 AC 104 ms
100,240 KB
testcase_34 AC 104 ms
100,128 KB
testcase_35 AC 105 ms
100,112 KB
testcase_36 AC 108 ms
99,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M = map(int, input().split())
A = list(map(int, input().split()))
X = [0] * M
for a in A:
    X[a % M] += 1
ans = 0
for i in range(M // 2 + 1):
    if i == 0:
        ans += min(1, X[0])
    elif i == M//2:
        if M % 2 == 0:
            ans += min(1, X[M // 2])
        else:
            ans += max(X[i], X[M - i])
    else:
        ans += max(X[i], X[M - i])
print(ans)
0