結果

問題 No.1972 Modulo Set
ユーザー gr1msl3ygr1msl3y
提出日時 2022-06-11 01:11:34
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 274 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 81,676 KB
実行使用メモリ 257,056 KB
最終ジャッジ日時 2023-10-21 07:19:18
合計ジャッジ時間 13,426 ms
ジャッジサーバーID
(参考情報)
judge11 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,548 KB
testcase_01 AC 39 ms
53,548 KB
testcase_02 AC 39 ms
53,548 KB
testcase_03 AC 60 ms
69,132 KB
testcase_04 AC 64 ms
71,004 KB
testcase_05 AC 60 ms
72,328 KB
testcase_06 AC 71 ms
80,068 KB
testcase_07 AC 82 ms
87,856 KB
testcase_08 AC 55 ms
71,500 KB
testcase_09 AC 57 ms
66,380 KB
testcase_10 AC 59 ms
71,548 KB
testcase_11 AC 81 ms
86,200 KB
testcase_12 AC 57 ms
66,660 KB
testcase_13 AC 105 ms
87,108 KB
testcase_14 AC 92 ms
83,600 KB
testcase_15 AC 116 ms
90,172 KB
testcase_16 AC 150 ms
92,284 KB
testcase_17 AC 76 ms
77,212 KB
testcase_18 AC 49 ms
62,028 KB
testcase_19 AC 153 ms
93,360 KB
testcase_20 AC 169 ms
95,704 KB
testcase_21 AC 80 ms
79,608 KB
testcase_22 AC 159 ms
95,368 KB
testcase_23 AC 838 ms
239,168 KB
testcase_24 AC 684 ms
238,836 KB
testcase_25 AC 936 ms
250,572 KB
testcase_26 AC 137 ms
94,740 KB
testcase_27 AC 1,182 ms
252,616 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 AC 1,365 ms
255,660 KB
testcase_34 AC 1,372 ms
257,056 KB
testcase_35 AC 1,370 ms
254,712 KB
testcase_36 AC 1,375 ms
255,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
A=list(map(int,input().split()))
B=[[0,i] for i in range(M)]
for a in A:
	B[a%M][0]+=1
B.sort(reverse=True)
S=set()
ans=0
for c,v in B:
	if 2*v%M==0:
		ans+=(c>0)
		S.add(v)
	else:
		if v not in S:
			ans+=c
			S.add(v)
			S.add(M-v)
print(ans)
0