結果

問題 No.1972 Modulo Set
ユーザー shobonvipshobonvip
提出日時 2022-06-11 15:26:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 180 ms / 2,000 ms
コード長 326 bytes
コンパイル時間 335 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 108,756 KB
最終ジャッジ日時 2024-04-15 08:59:05
合計ジャッジ時間 5,772 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
53,504 KB
testcase_01 AC 53 ms
53,760 KB
testcase_02 AC 52 ms
53,504 KB
testcase_03 AC 76 ms
70,784 KB
testcase_04 AC 79 ms
72,832 KB
testcase_05 AC 86 ms
74,368 KB
testcase_06 AC 89 ms
80,768 KB
testcase_07 AC 106 ms
90,324 KB
testcase_08 AC 72 ms
73,472 KB
testcase_09 AC 69 ms
65,664 KB
testcase_10 AC 77 ms
72,564 KB
testcase_11 AC 103 ms
89,168 KB
testcase_12 AC 74 ms
69,376 KB
testcase_13 AC 68 ms
65,792 KB
testcase_14 AC 74 ms
67,296 KB
testcase_15 AC 123 ms
92,796 KB
testcase_16 AC 127 ms
95,068 KB
testcase_17 AC 90 ms
77,056 KB
testcase_18 AC 49 ms
53,888 KB
testcase_19 AC 121 ms
91,408 KB
testcase_20 AC 135 ms
97,148 KB
testcase_21 AC 98 ms
79,528 KB
testcase_22 AC 106 ms
89,072 KB
testcase_23 AC 161 ms
104,140 KB
testcase_24 AC 99 ms
84,864 KB
testcase_25 AC 116 ms
95,360 KB
testcase_26 AC 133 ms
97,112 KB
testcase_27 AC 163 ms
105,692 KB
testcase_28 AC 92 ms
84,480 KB
testcase_29 AC 108 ms
93,440 KB
testcase_30 AC 130 ms
105,088 KB
testcase_31 AC 66 ms
64,640 KB
testcase_32 AC 124 ms
101,248 KB
testcase_33 AC 178 ms
108,672 KB
testcase_34 AC 180 ms
108,672 KB
testcase_35 AC 173 ms
108,492 KB
testcase_36 AC 174 ms
108,756 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
n,m = map(int,input().split())
a = list(map(int,input().split()))
ac = defaultdict(int)

for i in a:
	ac[i%m] += 1

ans = 0
for i, j in list(ac.items()):
	if i == (m-i)%m and j >= 1:
		ans += 1
	elif j > ac[(m-i)%m]:
		ans += j
	elif j == ac[(m-i)%m] and i > (m-i)%m:
		ans += j

print(ans)
0