結果

問題 No.29 パワーアップ
ユーザー 2329 N
提出日時 2020-09-04 19:08:08
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 687 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-26 11:07:36
合計ジャッジ時間 1,583 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
itm = []
for i in  range(n):
   itm += (list(map(int, input().split())))

#偶数個あるアイテムでのパワーアップ
p_1 = [itm.count(i) // 2 for i in set(itm) if itm.count(i) % 2 == 0]
p_1s = sum(p_1)

#奇数個あるアイテムでのパワーアップ(1個は数えず)
p_2 = [itm.count(i) // 2 for i in set(itm) if itm.count(i) % 2 == 1 and itm.count(i) != 1]
p_2s = sum(p_2) 

#その他でのパワーアップ
p_3 = [itm.count(i) % 2 for i in set(itm) if itm.count(i) % 2 == 1 and itm.count(i) != 1]
p_3s = sum(p_2) 

p_4 = [itm.count(i) for i in set(itm) if itm.count(i)  == 1]
p_4s = sum(p_4)

p_5s = (p_3s + p_4s) // 4

print(p_1s + p_2s + p_5s)
0