結果
| 問題 |
No.1972 Modulo Set
|
| コンテスト | |
| ユーザー |
taiga0629kyopro
|
| 提出日時 | 2022-06-12 12:15:37 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 153 ms / 2,000 ms |
| コード長 | 399 bytes |
| コンパイル時間 | 225 ms |
| コンパイル使用メモリ | 82,236 KB |
| 実行使用メモリ | 126,888 KB |
| 最終ジャッジ日時 | 2024-10-05 01:45:31 |
| 合計ジャッジ時間 | 4,744 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
ソースコード
from _collections import defaultdict
n,m=map(int,input().split())
s=set()
a=list(map(int,input().split()))
for i in range(n):a[i]%=m
cnt=defaultdict(int)
ans=0
nod=set()
for x in a:
cnt[x]+=1
for x in cnt:
nod.add(x)
nod.add((m-x)%m)
for x in nod:
y=(m-x)%m
if y<x:continue
if x==y:
ans+=min(1,cnt[x])
continue
ans+=max(cnt[x],cnt[y])
print(ans)
taiga0629kyopro