結果

問題 No.1972 Modulo Set
ユーザー ShirotsumeShirotsume
提出日時 2022-06-11 00:02:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 592 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 81,212 KB
実行使用メモリ 114,332 KB
最終ジャッジ日時 2023-10-21 06:02:45
合計ジャッジ時間 4,901 ms
ジャッジサーバーID
(参考情報)
judge13 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
55,488 KB
testcase_01 AC 39 ms
55,488 KB
testcase_02 AC 37 ms
55,488 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 49 ms
66,420 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 50 ms
66,544 KB
testcase_14 AC 53 ms
68,604 KB
testcase_15 WA -
testcase_16 AC 94 ms
93,456 KB
testcase_17 AC 69 ms
77,616 KB
testcase_18 AC 38 ms
55,488 KB
testcase_19 AC 85 ms
88,704 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 80 ms
92,860 KB
testcase_23 AC 128 ms
103,652 KB
testcase_24 AC 75 ms
89,272 KB
testcase_25 AC 85 ms
101,380 KB
testcase_26 WA -
testcase_27 AC 116 ms
103,992 KB
testcase_28 AC 69 ms
88,236 KB
testcase_29 AC 82 ms
100,540 KB
testcase_30 AC 100 ms
114,332 KB
testcase_31 AC 53 ms
66,412 KB
testcase_32 AC 88 ms
108,960 KB
testcase_33 AC 133 ms
108,940 KB
testcase_34 AC 144 ms
109,264 KB
testcase_35 AC 131 ms
109,260 KB
testcase_36 AC 136 ms
109,252 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 or m - 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