結果

問題 No.1972 Modulo Set
ユーザー pitPpitP
提出日時 2022-06-10 21:55:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 334 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 36,828 KB
最終ジャッジ日時 2023-10-21 05:06:49
合計ジャッジ時間 6,144 ms
ジャッジサーバーID
(参考情報)
judge12 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,064 KB
testcase_01 AC 29 ms
10,064 KB
testcase_02 AC 30 ms
10,064 KB
testcase_03 AC 56 ms
12,632 KB
testcase_04 AC 72 ms
13,332 KB
testcase_05 WA -
testcase_06 AC 109 ms
15,988 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 34 ms
10,608 KB
testcase_10 WA -
testcase_11 AC 152 ms
18,608 KB
testcase_12 AC 47 ms
11,468 KB
testcase_13 AC 38 ms
11,076 KB
testcase_14 AC 38 ms
11,132 KB
testcase_15 AC 163 ms
18,348 KB
testcase_16 AC 173 ms
20,684 KB
testcase_17 AC 77 ms
14,308 KB
testcase_18 AC 29 ms
10,088 KB
testcase_19 AC 138 ms
20,296 KB
testcase_20 AC 177 ms
20,720 KB
testcase_21 AC 85 ms
14,796 KB
testcase_22 AC 121 ms
20,036 KB
testcase_23 AC 214 ms
25,880 KB
testcase_24 AC 97 ms
18,056 KB
testcase_25 AC 138 ms
24,140 KB
testcase_26 WA -
testcase_27 AC 217 ms
26,024 KB
testcase_28 AC 100 ms
18,076 KB
testcase_29 AC 141 ms
22,720 KB
testcase_30 AC 185 ms
25,068 KB
testcase_31 AC 36 ms
10,996 KB
testcase_32 AC 165 ms
23,900 KB
testcase_33 AC 254 ms
36,828 KB
testcase_34 AC 251 ms
36,828 KB
testcase_35 AC 248 ms
36,828 KB
testcase_36 AC 254 ms
36,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
n,m = map(int,input().split())
a = list(map(int,input().split()))
b = [num%m for num in a]

d = defaultdict(int)
ans = 0
for num in b:
    if num == 0:
        ans |= 1
    else:
        d[num] += 1

d[m] = 0
for num in b:
    ans += max(d[num],d[m-num])
    d[num] = 0
    d[m-num] = 0

print(ans)
0