結果

問題 No.1972 Modulo Set
ユーザー ShirotsumeShirotsume
提出日時 2022-06-11 00:01:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 578 bytes
コンパイル時間 372 ms
コンパイル使用メモリ 81,712 KB
実行使用メモリ 114,376 KB
最終ジャッジ日時 2023-10-21 06:01:57
合計ジャッジ時間 5,029 ms
ジャッジサーバーID
(参考情報)
judge9 / judge10
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
55,564 KB
testcase_01 AC 41 ms
55,564 KB
testcase_02 AC 44 ms
55,564 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 54 ms
64,512 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 56 ms
66,688 KB
testcase_14 AC 57 ms
66,704 KB
testcase_15 WA -
testcase_16 AC 104 ms
93,604 KB
testcase_17 AC 71 ms
77,760 KB
testcase_18 AC 43 ms
55,564 KB
testcase_19 AC 98 ms
89,116 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 89 ms
92,896 KB
testcase_23 AC 135 ms
103,800 KB
testcase_24 AC 81 ms
89,420 KB
testcase_25 AC 99 ms
101,428 KB
testcase_26 WA -
testcase_27 AC 137 ms
104,152 KB
testcase_28 AC 75 ms
88,384 KB
testcase_29 AC 92 ms
100,688 KB
testcase_30 AC 116 ms
114,376 KB
testcase_31 AC 55 ms
66,556 KB
testcase_32 AC 106 ms
109,044 KB
testcase_33 AC 158 ms
109,400 KB
testcase_34 AC 153 ms
109,396 KB
testcase_35 AC 154 ms
109,400 KB
testcase_36 AC 148 ms
109,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
INF = 2 ** 63 - 1
mod = 998244353

from collections import Counter


n, m = mi() 

a = li()

C = Counter()

for v in a:
    C[v % m] += 1

ans = 0
s = set()
for c, v in C.items():
    if c in s: continue
    if m % 2 == 0 and c == m // 2:
        s.add(c)
        ans += min(v, 1)
    else:
        s.add(c)
        s.add(m - c)
        if v > C[m - c]:
            ans += v
        else:
            ans += C[m - c]
    
print(ans)
0