結果
問題 | No.1972 Modulo Set |
ユーザー |
|
提出日時 | 2022-11-07 16:28:15 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 636 bytes |
コンパイル時間 | 270 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 23,492 KB |
最終ジャッジ日時 | 2024-07-21 00:04:38 |
合計ジャッジ時間 | 6,892 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 TLE * 1 -- * 8 |
ソースコード
from collections import Counter def main(): N, M = map(int, input().split()) set_ = list(map(int, input().split())) modulo_list = map(lambda num: num % M, set_) modulo_counter = Counter(modulo_list) element_sum = 0 if modulo_counter[0] > 0: element_sum += 1 if M % 2 == 0 and modulo_counter[M // 2] > 0: element_sum += 1 for num in range(1, (M+1)//2): if modulo_counter[num] > modulo_counter[M-num]: element_sum += modulo_counter[num] else: element_sum += modulo_counter[M-num] print(element_sum) if __name__ == "__main__": main()