結果

問題 No.1972 Modulo Set
ユーザー chineristACchineristAC
提出日時 2022-06-10 21:42:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 574 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 81,872 KB
実行使用メモリ 107,616 KB
最終ジャッジ日時 2024-04-15 08:49:13
合計ジャッジ時間 4,994 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
57,664 KB
testcase_01 AC 50 ms
56,220 KB
testcase_02 AC 50 ms
56,124 KB
testcase_03 AC 69 ms
71,960 KB
testcase_04 AC 71 ms
74,692 KB
testcase_05 AC 72 ms
76,240 KB
testcase_06 AC 93 ms
82,044 KB
testcase_07 AC 99 ms
90,816 KB
testcase_08 AC 70 ms
75,128 KB
testcase_09 AC 63 ms
67,268 KB
testcase_10 AC 70 ms
74,884 KB
testcase_11 AC 105 ms
89,560 KB
testcase_12 AC 66 ms
71,400 KB
testcase_13 AC 61 ms
67,916 KB
testcase_14 AC 62 ms
67,056 KB
testcase_15 AC 99 ms
92,344 KB
testcase_16 AC 105 ms
94,956 KB
testcase_17 AC 75 ms
77,940 KB
testcase_18 AC 50 ms
56,360 KB
testcase_19 AC 96 ms
89,820 KB
testcase_20 AC 105 ms
96,308 KB
testcase_21 AC 78 ms
78,364 KB
testcase_22 AC 87 ms
85,656 KB
testcase_23 AC 119 ms
103,204 KB
testcase_24 AC 77 ms
79,588 KB
testcase_25 AC 89 ms
88,828 KB
testcase_26 AC 110 ms
97,920 KB
testcase_27 AC 119 ms
104,724 KB
testcase_28 AC 75 ms
78,956 KB
testcase_29 AC 83 ms
85,852 KB
testcase_30 AC 95 ms
94,252 KB
testcase_31 AC 58 ms
65,648 KB
testcase_32 AC 94 ms
92,028 KB
testcase_33 AC 123 ms
107,616 KB
testcase_34 AC 125 ms
107,388 KB
testcase_35 AC 127 ms
107,252 KB
testcase_36 AC 128 ms
107,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random,bisect
from collections import deque,defaultdict,Counter
from heapq import heapify,heappop,heappush
from itertools import cycle, permutations
from math import log,gcd

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

N,M = mi()
A = li()

S = {a%M:0 for a in A}
for a in A:
    a %= M
    S[a] += 1
    
res = 0
for a in S:
    if (M-a)%M not in S:
        res += S[a]
    else:
        if a < (M-a)%M:
            res += max(S[a],S[M-a])
        elif a==(M-a)%M:
            res += 1

print(res)
0