結果

問題 No.1972 Modulo Set
ユーザー tonyu0tonyu0
提出日時 2022-06-10 23:42:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 411 ms / 2,000 ms
コード長 356 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 34,548 KB
最終ジャッジ日時 2024-04-15 08:55:39
合計ジャッジ時間 7,616 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,752 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 AC 58 ms
12,996 KB
testcase_04 AC 61 ms
14,032 KB
testcase_05 AC 66 ms
14,544 KB
testcase_06 AC 89 ms
16,412 KB
testcase_07 AC 118 ms
20,352 KB
testcase_08 AC 68 ms
14,788 KB
testcase_09 AC 38 ms
11,264 KB
testcase_10 AC 62 ms
14,148 KB
testcase_11 AC 117 ms
19,512 KB
testcase_12 AC 48 ms
12,160 KB
testcase_13 AC 48 ms
11,776 KB
testcase_14 AC 47 ms
11,776 KB
testcase_15 AC 153 ms
19,452 KB
testcase_16 AC 184 ms
20,344 KB
testcase_17 AC 78 ms
14,720 KB
testcase_18 AC 32 ms
10,752 KB
testcase_19 AC 169 ms
19,628 KB
testcase_20 AC 199 ms
20,272 KB
testcase_21 AC 88 ms
15,432 KB
testcase_22 AC 155 ms
19,564 KB
testcase_23 AC 352 ms
24,684 KB
testcase_24 AC 155 ms
18,668 KB
testcase_25 AC 222 ms
24,236 KB
testcase_26 AC 192 ms
22,224 KB
testcase_27 AC 364 ms
25,552 KB
testcase_28 AC 167 ms
18,680 KB
testcase_29 AC 234 ms
24,260 KB
testcase_30 AC 312 ms
24,600 KB
testcase_31 AC 46 ms
11,648 KB
testcase_32 AC 281 ms
24,544 KB
testcase_33 AC 411 ms
34,160 KB
testcase_34 AC 409 ms
34,548 KB
testcase_35 AC 406 ms
34,204 KB
testcase_36 AC 408 ms
34,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
n,m=map(int,input().split())
a=list(map(lambda x : int(x) % m,input().split()))
d=defaultdict(int)
for b in a:
    d[b]+=1
    d[m-b]
ans=0
zero=0
onaji=0
for k in d.keys():
    if k==0:
        zero=1
    elif k+k==m:
        onaji=1
    else:
        ans+=max(d[k],d[m-k])
    d[k]=0
    d[m-k]=0
print(ans+zero+onaji)
0