結果

問題 No.1972 Modulo Set
ユーザー ShirotsumeShirotsume
提出日時 2022-06-11 00:00:41
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 591 bytes
コンパイル時間 1,033 ms
コンパイル使用メモリ 81,408 KB
実行使用メモリ 107,368 KB
最終ジャッジ日時 2023-10-21 06:00:31
合計ジャッジ時間 5,605 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
55,436 KB
testcase_01 AC 37 ms
55,436 KB
testcase_02 AC 35 ms
55,436 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 43 ms
55,448 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 68 ms
82,076 KB
testcase_29 AC 77 ms
93,212 KB
testcase_30 AC 87 ms
103,744 KB
testcase_31 AC 47 ms
64,332 KB
testcase_32 AC 86 ms
99,496 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

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(m // 2)
        ans += min(v, 1)
    else:
        if v > C[m - c]:
            s.add(c)
            ans += v
        else:
            s.add(m - c)
            ans += C[m - c]
    
print(ans)
0