結果
| 問題 |
No.1972 Modulo Set
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-11-07 16:29:56 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 609 bytes |
| コンパイル時間 | 182 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 23,356 KB |
| 最終ジャッジ日時 | 2024-07-21 00:05:14 |
| 合計ジャッジ時間 | 6,890 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 TLE * 1 -- * 8 |
ソースコード
from collections import Counter
def main():
N, M = map(int, input().split())
modulo_list = map(lambda num: int(num) % M, input().split())
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()