結果

問題 No.1972 Modulo Set
ユーザー ygd.ygd.
提出日時 2022-06-10 21:55:11
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 995 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 81,696 KB
実行使用メモリ 896,380 KB
最終ジャッジ日時 2023-10-21 05:07:11
合計ジャッジ時間 7,893 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 AC 46 ms
53,440 KB
testcase_02 AC 46 ms
53,440 KB
testcase_03 AC 59 ms
68,868 KB
testcase_04 AC 61 ms
70,492 KB
testcase_05 AC 61 ms
71,640 KB
testcase_06 AC 69 ms
76,892 KB
testcase_07 AC 76 ms
84,296 KB
testcase_08 AC 60 ms
70,804 KB
testcase_09 AC 59 ms
66,344 KB
testcase_10 AC 60 ms
70,988 KB
testcase_11 AC 75 ms
83,024 KB
testcase_12 AC 58 ms
66,484 KB
testcase_13 AC 64 ms
73,412 KB
testcase_14 AC 64 ms
70,896 KB
testcase_15 AC 87 ms
86,720 KB
testcase_16 AC 95 ms
92,764 KB
testcase_17 AC 71 ms
74,252 KB
testcase_18 AC 48 ms
61,852 KB
testcase_19 AC 91 ms
89,552 KB
testcase_20 AC 101 ms
94,888 KB
testcase_21 AC 74 ms
77,436 KB
testcase_22 AC 89 ms
89,416 KB
testcase_23 AC 198 ms
186,864 KB
testcase_24 AC 166 ms
175,060 KB
testcase_25 AC 191 ms
197,532 KB
testcase_26 AC 102 ms
94,400 KB
testcase_27 AC 238 ms
234,468 KB
testcase_28 MLE -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#input = sys.stdin.readline
input = sys.stdin.buffer.readline #文字列はダメ
#sys.setrecursionlimit(1000000)
#import bisect
#import itertools
#import random
#from heapq import heapify, heappop, heappush
from collections import defaultdict 
#from collections import deque
#import copy
#import math
#from functools import lru_cache
#@lru_cache(maxsize=None)
#MOD = pow(10,9) + 7
#MOD = 998244353
#dx = [1,0,-1,0]
#dy = [0,1,0,-1]
#dx8 = [1,1,0,-1,-1,-1,0,1]
#dy8 = [0,1,1,1,0,-1,-1,-1]

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

    dic = defaultdict(int)
    for a in A:
        dic[a%M] += 1
    
    ans = 0
    if M%2 == 0:
        ans += min(1, dic[0])
        for i in range(1,M//2):
            ans += max(dic[i], dic[M-i])
        ans += min(1, dic[M//2])
    else:
        ans += min(1, dic[0])
        for i in range(1,(M+1)//2):
            ans += max(dic[i], dic[M-i])

    print(ans)

if __name__ == '__main__':
    main()
0