結果

問題 No.1972 Modulo Set
ユーザー titiatitia
提出日時 2022-06-10 21:30:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 350 ms / 2,000 ms
コード長 419 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 40,388 KB
最終ジャッジ日時 2024-04-15 08:46:25
合計ジャッジ時間 6,749 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,752 KB
testcase_01 AC 31 ms
10,624 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 AC 57 ms
13,628 KB
testcase_04 AC 62 ms
13,880 KB
testcase_05 AC 64 ms
14,400 KB
testcase_06 AC 84 ms
16,648 KB
testcase_07 AC 114 ms
19,728 KB
testcase_08 AC 66 ms
15,352 KB
testcase_09 AC 38 ms
11,264 KB
testcase_10 AC 61 ms
14,048 KB
testcase_11 AC 112 ms
19,376 KB
testcase_12 AC 46 ms
12,160 KB
testcase_13 AC 42 ms
11,904 KB
testcase_14 AC 45 ms
11,904 KB
testcase_15 AC 145 ms
19,924 KB
testcase_16 AC 165 ms
20,436 KB
testcase_17 AC 75 ms
14,736 KB
testcase_18 AC 31 ms
10,752 KB
testcase_19 AC 148 ms
19,408 KB
testcase_20 AC 177 ms
21,604 KB
testcase_21 AC 83 ms
15,360 KB
testcase_22 AC 132 ms
19,692 KB
testcase_23 AC 280 ms
28,156 KB
testcase_24 AC 123 ms
18,316 KB
testcase_25 AC 186 ms
25,324 KB
testcase_26 AC 178 ms
21,592 KB
testcase_27 AC 302 ms
35,172 KB
testcase_28 AC 132 ms
18,056 KB
testcase_29 AC 191 ms
24,640 KB
testcase_30 AC 252 ms
25,956 KB
testcase_31 AC 42 ms
11,904 KB
testcase_32 AC 221 ms
25,144 KB
testcase_33 AC 343 ms
40,120 KB
testcase_34 AC 336 ms
40,388 KB
testcase_35 AC 350 ms
40,124 KB
testcase_36 AC 337 ms
40,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import Counter

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

X=Counter()

for a in A:
    X[a%M]+=1

ANS=0
USE=set()

for x in X:
    #print(x,USE)
    if x!=M/2 and x!=0 and not(x in USE):
        y=M-x

        ANS+=max(X[x],X[y])
        USE.add(x)
        USE.add(y)
    elif x==M/2:
        ANS+=1
    elif x==0:
        ANS+=1

print(ANS)

0