結果

問題 No.1972 Modulo Set
ユーザー Omura ShunsukeOmura Shunsuke
提出日時 2022-06-11 17:21:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 492 bytes
コンパイル時間 184 ms
コンパイル使用メモリ 82,424 KB
実行使用メモリ 107,776 KB
最終ジャッジ日時 2024-04-15 08:58:53
合計ジャッジ時間 4,323 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
51,712 KB
testcase_01 AC 39 ms
52,096 KB
testcase_02 AC 39 ms
52,352 KB
testcase_03 AC 58 ms
69,504 KB
testcase_04 AC 59 ms
71,552 KB
testcase_05 AC 61 ms
73,216 KB
testcase_06 AC 68 ms
79,488 KB
testcase_07 AC 84 ms
89,856 KB
testcase_08 AC 56 ms
71,936 KB
testcase_09 AC 52 ms
64,000 KB
testcase_10 AC 60 ms
71,424 KB
testcase_11 AC 81 ms
88,628 KB
testcase_12 AC 57 ms
67,712 KB
testcase_13 AC 48 ms
62,976 KB
testcase_14 AC 52 ms
64,640 KB
testcase_15 AC 89 ms
91,904 KB
testcase_16 AC 94 ms
93,824 KB
testcase_17 AC 63 ms
73,960 KB
testcase_18 AC 38 ms
51,840 KB
testcase_19 AC 85 ms
86,144 KB
testcase_20 AC 95 ms
95,360 KB
testcase_21 AC 67 ms
76,032 KB
testcase_22 AC 77 ms
84,224 KB
testcase_23 AC 109 ms
102,144 KB
testcase_24 AC 67 ms
76,672 KB
testcase_25 AC 78 ms
84,480 KB
testcase_26 AC 101 ms
97,104 KB
testcase_27 AC 110 ms
103,936 KB
testcase_28 AC 63 ms
75,136 KB
testcase_29 AC 72 ms
82,688 KB
testcase_30 AC 82 ms
90,880 KB
testcase_31 AC 47 ms
62,108 KB
testcase_32 AC 78 ms
88,040 KB
testcase_33 AC 118 ms
107,700 KB
testcase_34 AC 117 ms
107,776 KB
testcase_35 AC 119 ms
107,648 KB
testcase_36 AC 120 ms
107,536 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M = map(int,input().split())
A = list(map(int,input().split()))


D = {}

for i in range(N):
    if A[i] % M not in D:
        D[A[i] % M] = 0
    D[A[i] % M] += 1
        
ans = 0

S = set()
for k,v in D.items():
    if k == M-k:
        ans += 1
    elif k == 0:
        ans += 1
    else:
        if k not in S:
            if M-k in D:
                ans += max(D[k],D[M-k])
                S.add(M-k)
            else:
                ans += D[k]
                
print(ans)
#print(D)
0