結果

問題 No.1972 Modulo Set
ユーザー nohakai3nohakai3
提出日時 2022-07-29 11:08:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 347 ms / 2,000 ms
コード長 591 bytes
コンパイル時間 255 ms
コンパイル使用メモリ 10,992 KB
実行使用メモリ 34,748 KB
最終ジャッジ日時 2023-09-26 07:28:01
合計ジャッジ時間 9,105 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,436 KB
testcase_01 AC 20 ms
8,524 KB
testcase_02 AC 19 ms
8,560 KB
testcase_03 AC 40 ms
10,936 KB
testcase_04 AC 48 ms
11,640 KB
testcase_05 AC 53 ms
12,412 KB
testcase_06 AC 71 ms
14,428 KB
testcase_07 AC 101 ms
17,700 KB
testcase_08 AC 56 ms
13,244 KB
testcase_09 AC 26 ms
9,104 KB
testcase_10 AC 48 ms
11,772 KB
testcase_11 AC 99 ms
17,168 KB
testcase_12 AC 34 ms
10,016 KB
testcase_13 AC 32 ms
9,384 KB
testcase_14 AC 33 ms
9,596 KB
testcase_15 AC 131 ms
16,660 KB
testcase_16 AC 151 ms
18,656 KB
testcase_17 AC 62 ms
12,480 KB
testcase_18 AC 20 ms
8,656 KB
testcase_19 AC 138 ms
18,624 KB
testcase_20 AC 166 ms
18,944 KB
testcase_21 AC 70 ms
13,568 KB
testcase_22 AC 122 ms
17,428 KB
testcase_23 AC 296 ms
23,708 KB
testcase_24 AC 120 ms
16,684 KB
testcase_25 AC 175 ms
22,344 KB
testcase_26 AC 165 ms
19,756 KB
testcase_27 AC 305 ms
23,764 KB
testcase_28 AC 130 ms
16,492 KB
testcase_29 AC 189 ms
21,520 KB
testcase_30 AC 261 ms
22,488 KB
testcase_31 AC 31 ms
9,496 KB
testcase_32 AC 231 ms
22,436 KB
testcase_33 AC 334 ms
34,688 KB
testcase_34 AC 347 ms
34,688 KB
testcase_35 AC 345 ms
34,748 KB
testcase_36 AC 330 ms
34,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

n,m=list(map(int,input().split()))
seq=list(map(int,input().split()))
cnt=0
am=defaultdict(int)

for i in range(len(seq)):
    sur=seq[i]%m
    am[sur]+=1
    am[m-sur]+=0

if am[0]>0:
    
    cnt+=1
    am[0]=0
if m%2==0:
    if am[int(m/2)]>0:
        cnt+=1
        am[int(m/2)]=0
        
    for i in am.keys():
        if i!=0:
            cnt+=max(am[i],am[m-i])
            am[i]=0
            am[m-i]=0

else:
    for i in am.keys():
        if i!=0:
            cnt+=max(am[i],am[m-i])
            am[i]=0
            am[m-i]=0
    
print(cnt)
0