結果

問題 No.1972 Modulo Set
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-06-10 22:29:47
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 480 bytes
コンパイル時間 374 ms
コンパイル使用メモリ 87,264 KB
実行使用メモリ 108,716 KB
最終ジャッジ日時 2023-07-27 22:25:18
合計ジャッジ時間 5,675 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,460 KB
testcase_01 AC 67 ms
71,552 KB
testcase_02 AC 68 ms
71,552 KB
testcase_03 AC 89 ms
77,464 KB
testcase_04 AC 90 ms
79,452 KB
testcase_05 AC 89 ms
80,664 KB
testcase_06 AC 96 ms
84,188 KB
testcase_07 AC 107 ms
91,056 KB
testcase_08 AC 85 ms
81,920 KB
testcase_09 AC 82 ms
76,696 KB
testcase_10 AC 87 ms
79,816 KB
testcase_11 AC 105 ms
89,372 KB
testcase_12 AC 85 ms
76,940 KB
testcase_13 AC 79 ms
76,636 KB
testcase_14 AC 87 ms
76,872 KB
testcase_15 AC 117 ms
92,932 KB
testcase_16 AC 123 ms
94,792 KB
testcase_17 AC 91 ms
80,388 KB
testcase_18 AC 70 ms
71,556 KB
testcase_19 AC 107 ms
90,036 KB
testcase_20 AC 117 ms
96,728 KB
testcase_21 AC 93 ms
81,992 KB
testcase_22 AC 101 ms
87,936 KB
testcase_23 AC 124 ms
103,392 KB
testcase_24 AC 95 ms
84,516 KB
testcase_25 AC 99 ms
90,436 KB
testcase_26 AC 121 ms
98,088 KB
testcase_27 AC 125 ms
104,512 KB
testcase_28 AC 92 ms
84,300 KB
testcase_29 AC 97 ms
90,196 KB
testcase_30 AC 105 ms
97,072 KB
testcase_31 AC 78 ms
76,648 KB
testcase_32 AC 99 ms
94,516 KB
testcase_33 AC 131 ms
108,716 KB
testcase_34 AC 133 ms
108,348 KB
testcase_35 AC 132 ms
108,596 KB
testcase_36 AC 134 ms
108,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
dic = {}
A = list(map(int,input().split()))
for a in A:
    dic[a%m] = dic.get(a%m,0) + 1
    
ans = 0
done = set()
for key,value in dic.items():
    if key in done:
        continue
    if key == 0:
        ans += 1
        continue
    if m-key in dic:
        if m-key == key:
            ans += 1
        else:
            val2 = dic[m-key]
            ans += max(value,val2)
            done.add(m-key)
    else:
        ans += value
print(ans)
0