結果

問題 No.1972 Modulo Set
ユーザー ニックネームニックネーム
提出日時 2022-06-10 21:52:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 365 ms / 2,000 ms
コード長 339 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 41,808 KB
最終ジャッジ日時 2024-04-15 08:49:41
合計ジャッジ時間 6,960 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
10,880 KB
testcase_01 AC 33 ms
10,752 KB
testcase_02 AC 33 ms
10,752 KB
testcase_03 AC 57 ms
12,728 KB
testcase_04 AC 58 ms
13,124 KB
testcase_05 AC 61 ms
13,648 KB
testcase_06 AC 75 ms
14,996 KB
testcase_07 AC 97 ms
17,692 KB
testcase_08 AC 61 ms
14,224 KB
testcase_09 AC 38 ms
11,392 KB
testcase_10 AC 56 ms
13,068 KB
testcase_11 AC 98 ms
17,416 KB
testcase_12 AC 46 ms
11,904 KB
testcase_13 AC 43 ms
11,776 KB
testcase_14 AC 43 ms
11,776 KB
testcase_15 AC 134 ms
19,488 KB
testcase_16 AC 157 ms
20,428 KB
testcase_17 AC 71 ms
14,212 KB
testcase_18 AC 33 ms
10,752 KB
testcase_19 AC 152 ms
19,532 KB
testcase_20 AC 174 ms
22,024 KB
testcase_21 AC 79 ms
14,816 KB
testcase_22 AC 134 ms
20,236 KB
testcase_23 AC 282 ms
26,568 KB
testcase_24 AC 128 ms
19,688 KB
testcase_25 AC 184 ms
26,268 KB
testcase_26 AC 170 ms
21,568 KB
testcase_27 AC 306 ms
30,724 KB
testcase_28 AC 141 ms
19,564 KB
testcase_29 AC 191 ms
26,464 KB
testcase_30 AC 259 ms
26,564 KB
testcase_31 AC 42 ms
11,904 KB
testcase_32 AC 247 ms
26,348 KB
testcase_33 AC 365 ms
41,808 KB
testcase_34 AC 354 ms
41,780 KB
testcase_35 AC 359 ms
41,708 KB
testcase_36 AC 347 ms
41,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
n, m = map(int, input().split())
count = defaultdict(int)
for v in map(int, input().split()): count[v%m] += 1
ans = 0
check = set()
for k in list(count.keys()):
    if k*2%m == 0: ans += min(count[k], 1)
    elif k not in check:
        ans += max(count[k], count[m-k])
        check.add(m-k)
print(ans)
0