結果

問題 No.1972 Modulo Set
ユーザー 河野竜也河野竜也
提出日時 2022-06-23 13:12:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 303 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 351,296 KB
最終ジャッジ日時 2024-04-24 18:45:04
合計ジャッジ時間 11,157 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
16,384 KB
testcase_01 AC 32 ms
10,752 KB
testcase_02 AC 26 ms
10,752 KB
testcase_03 AC 42 ms
13,040 KB
testcase_04 AC 50 ms
13,760 KB
testcase_05 AC 50 ms
14,672 KB
testcase_06 AC 66 ms
16,624 KB
testcase_07 AC 89 ms
19,804 KB
testcase_08 AC 54 ms
15,208 KB
testcase_09 AC 40 ms
11,520 KB
testcase_10 AC 49 ms
14,124 KB
testcase_11 AC 87 ms
19,496 KB
testcase_12 AC 41 ms
12,160 KB
testcase_13 AC 87 ms
16,188 KB
testcase_14 AC 73 ms
13,564 KB
testcase_15 AC 118 ms
18,944 KB
testcase_16 AC 152 ms
20,680 KB
testcase_17 AC 66 ms
14,704 KB
testcase_18 AC 34 ms
11,264 KB
testcase_19 AC 158 ms
20,380 KB
testcase_20 AC 170 ms
20,480 KB
testcase_21 AC 72 ms
15,316 KB
testcase_22 AC 152 ms
19,808 KB
testcase_23 AC 864 ms
57,384 KB
testcase_24 AC 817 ms
54,072 KB
testcase_25 AC 1,046 ms
97,232 KB
testcase_26 AC 146 ms
22,628 KB
testcase_27 AC 1,196 ms
98,724 KB
testcase_28 TLE -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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