結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 28 ms
10,752 KB
testcase_03 AC 40 ms
12,612 KB
testcase_04 AC 47 ms
13,772 KB
testcase_05 AC 52 ms
14,532 KB
testcase_06 AC 64 ms
16,740 KB
testcase_07 AC 90 ms
19,868 KB
testcase_08 AC 54 ms
15,228 KB
testcase_09 AC 31 ms
11,008 KB
testcase_10 AC 50 ms
14,016 KB
testcase_11 AC 80 ms
19,508 KB
testcase_12 AC 36 ms
11,904 KB
testcase_13 AC 40 ms
11,648 KB
testcase_14 AC 38 ms
11,776 KB
testcase_15 AC 83 ms
18,840 KB
testcase_16 AC 86 ms
18,852 KB
testcase_17 AC 48 ms
13,696 KB
testcase_18 AC 30 ms
10,752 KB
testcase_19 AC 82 ms
16,840 KB
testcase_20 AC 89 ms
18,704 KB
testcase_21 AC 53 ms
14,432 KB
testcase_22 AC 73 ms
16,144 KB
testcase_23 AC 188 ms
21,396 KB
testcase_24 AC 161 ms
19,196 KB
testcase_25 AC 194 ms
21,012 KB
testcase_26 AC 102 ms
21,600 KB
testcase_27 AC 241 ms
23,312 KB
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 AC 266 ms
25,396 KB
testcase_34 AC 267 ms
25,480 KB
testcase_35 AC 259 ms
25,500 KB
testcase_36 AC 273 ms
25,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())
a=list(map(int,input().split()))
ans=0
d=[0]*(m+1)
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