結果
問題 | No.1972 Modulo Set |
ユーザー |
|
提出日時 | 2022-11-07 16:21:50 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 625 bytes |
コンパイル時間 | 92 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 352,872 KB |
最終ジャッジ日時 | 2024-07-20 23:57:42 |
合計ジャッジ時間 | 8,359 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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) if modulo_counter[0] > 0: modulo_counter[0] = 1 if M % 2 == 0 and modulo_counter[M // 2] > 0: modulo_counter[M // 2] = 1 for num in range(1, (M+1)//2): if modulo_counter[num] > modulo_counter[M-num]: modulo_counter[M-num] = 0 else: modulo_counter[num] = 0 print(sum(modulo_counter.values())) if __name__ == "__main__": main()