結果

問題 No.1972 Modulo Set
ユーザー tassei903tassei903
提出日時 2022-06-10 21:30:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 170 ms / 2,000 ms
コード長 630 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 107,776 KB
最終ジャッジ日時 2024-04-15 08:46:11
合計ジャッジ時間 5,542 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
53,760 KB
testcase_01 AC 55 ms
53,632 KB
testcase_02 AC 54 ms
53,632 KB
testcase_03 AC 79 ms
69,888 KB
testcase_04 AC 77 ms
72,064 KB
testcase_05 AC 80 ms
74,380 KB
testcase_06 AC 87 ms
80,000 KB
testcase_07 AC 102 ms
89,548 KB
testcase_08 AC 75 ms
73,728 KB
testcase_09 AC 70 ms
65,340 KB
testcase_10 AC 77 ms
73,216 KB
testcase_11 AC 101 ms
88,832 KB
testcase_12 AC 75 ms
68,776 KB
testcase_13 AC 68 ms
66,176 KB
testcase_14 AC 73 ms
67,200 KB
testcase_15 AC 120 ms
91,844 KB
testcase_16 AC 121 ms
93,804 KB
testcase_17 AC 83 ms
75,008 KB
testcase_18 AC 51 ms
53,632 KB
testcase_19 AC 112 ms
89,932 KB
testcase_20 AC 125 ms
96,000 KB
testcase_21 AC 84 ms
77,056 KB
testcase_22 AC 103 ms
88,064 KB
testcase_23 AC 153 ms
104,704 KB
testcase_24 AC 93 ms
83,704 KB
testcase_25 AC 118 ms
93,824 KB
testcase_26 AC 125 ms
96,244 KB
testcase_27 AC 156 ms
105,080 KB
testcase_28 AC 93 ms
83,712 KB
testcase_29 AC 109 ms
92,800 KB
testcase_30 AC 129 ms
104,192 KB
testcase_31 AC 68 ms
64,640 KB
testcase_32 AC 120 ms
99,968 KB
testcase_33 AC 165 ms
107,760 KB
testcase_34 AC 170 ms
107,500 KB
testcase_35 AC 169 ms
107,776 KB
testcase_36 AC 170 ms
107,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
n,m = na()
a = na()
from collections import defaultdict
c = defaultdict(int)
for i in range(n):
    c[a[i]%m] += 1

ans = 0
for i in list(c):
    if i== 0 or i * 2 == m:
        ans += 1
    else:
        ans += max(c[i], c[m-i])
        c[i] = 0
        c[m-i] = 0
print(ans)
0