結果

問題 No.1972 Modulo Set
ユーザー 河野竜也河野竜也
提出日時 2022-06-20 13:06:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 275 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 25,396 KB
最終ジャッジ日時 2024-04-21 02:21:27
合計ジャッジ時間 6,094 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 33 ms
10,880 KB
testcase_02 AC 33 ms
10,624 KB
testcase_03 AC 42 ms
12,608 KB
testcase_04 AC 50 ms
13,648 KB
testcase_05 AC 53 ms
14,404 KB
testcase_06 AC 67 ms
16,772 KB
testcase_07 AC 86 ms
19,864 KB
testcase_08 AC 57 ms
15,220 KB
testcase_09 AC 33 ms
11,008 KB
testcase_10 AC 51 ms
13,904 KB
testcase_11 AC 86 ms
19,380 KB
testcase_12 AC 39 ms
11,904 KB
testcase_13 AC 41 ms
11,520 KB
testcase_14 AC 40 ms
11,520 KB
testcase_15 AC 86 ms
18,836 KB
testcase_16 AC 91 ms
18,852 KB
testcase_17 AC 53 ms
13,692 KB
testcase_18 AC 32 ms
10,624 KB
testcase_19 AC 82 ms
16,844 KB
testcase_20 AC 94 ms
18,708 KB
testcase_21 AC 57 ms
14,432 KB
testcase_22 AC 76 ms
16,008 KB
testcase_23 AC 200 ms
21,356 KB
testcase_24 AC 159 ms
19,152 KB
testcase_25 AC 206 ms
21,216 KB
testcase_26 AC 106 ms
21,596 KB
testcase_27 AC 252 ms
23,296 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 AC 280 ms
25,396 KB
testcase_34 AC 297 ms
25,276 KB
testcase_35 AC 290 ms
25,368 KB
testcase_36 AC 278 ms
25,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())
a=list(map(int,input().split()))
ans=0
d=[0]*m
for i in range(n):
  b=a[i]%m
  d[b]+=1
if d[0]:
  ans+=1
for i in range(1,(m//2)+1):
  if d[i]>=d[m-i]:
    ans+=d[i]
  else:
    ans+=d[m-i]
if m%2==0:
  if d[m//2]:
    ans-=(d[m//2]-1)
print(ans)
0