結果

問題 No.1972 Modulo Set
ユーザー terasaterasa
提出日時 2022-06-10 22:13:28
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,144 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 81,688 KB
実行使用メモリ 131,612 KB
最終ジャッジ日時 2023-10-21 05:18:58
合計ジャッジ時間 5,210 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
55,684 KB
testcase_01 AC 44 ms
55,684 KB
testcase_02 AC 45 ms
55,684 KB
testcase_03 AC 68 ms
73,320 KB
testcase_04 AC 72 ms
75,380 KB
testcase_05 WA -
testcase_06 AC 84 ms
83,440 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 59 ms
66,692 KB
testcase_10 WA -
testcase_11 AC 95 ms
87,520 KB
testcase_12 AC 68 ms
72,960 KB
testcase_13 AC 59 ms
69,000 KB
testcase_14 AC 60 ms
69,008 KB
testcase_15 AC 104 ms
88,856 KB
testcase_16 AC 113 ms
92,996 KB
testcase_17 AC 76 ms
78,892 KB
testcase_18 AC 45 ms
55,712 KB
testcase_19 AC 109 ms
92,360 KB
testcase_20 AC 116 ms
95,140 KB
testcase_21 AC 87 ms
81,976 KB
testcase_22 AC 100 ms
91,440 KB
testcase_23 AC 155 ms
116,248 KB
testcase_24 AC 92 ms
94,120 KB
testcase_25 AC 115 ms
98,460 KB
testcase_26 WA -
testcase_27 AC 162 ms
122,120 KB
testcase_28 AC 92 ms
96,208 KB
testcase_29 AC 116 ms
108,476 KB
testcase_30 AC 134 ms
107,988 KB
testcase_31 AC 58 ms
68,668 KB
testcase_32 AC 124 ms
104,100 KB
testcase_33 AC 178 ms
131,568 KB
testcase_34 AC 169 ms
131,192 KB
testcase_35 AC 168 ms
131,184 KB
testcase_36 AC 169 ms
131,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import pypyjit
import itertools
import heapq
import math
from collections import deque, defaultdict
import bisect

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
pypyjit.set_param('max_unroll_recursion=-1')


def index_lt(a, x):
    'return largest index s.t. A[i] < x or -1 if it does not exist'
    return bisect.bisect_left(a, x) - 1


def index_le(a, x):
    'return largest index s.t. A[i] <= x or -1 if it does not exist'
    return bisect.bisect_right(a, x) - 1


def index_gt(a, x):
    'return smallest index s.t. A[i] > x or len(a) if it does not exist'
    return bisect.bisect_right(a, x)


def index_ge(a, x):
    'return smallest index s.t. A[i] >= x or len(a) if it does not exist'
    return bisect.bisect_left(a, x)


N, M = map(int, input().split())
A = list(map(int, input().split()))

D = defaultdict(int)
checked = set()
zero = 0
for a in A:
    p = a % M
    if p == 0:
        zero = 1
        continue
    D[a % M] += 1
    D[M - a % M] += 0
ans = 0
for k in D.keys():
    if k in checked:
        continue
    checked.add(k)
    checked.add(M - k)
    ans += max(D[k], D[M - k])
print(ans + zero)
0