結果

問題 No.29 パワーアップ
ユーザー hanorver
提出日時 2017-06-06 20:48:41
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 31 ms / 5,000 ms
コード長 459 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-09-22 11:52:12
合計ジャッジ時間 1,681 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

n = int(input()) # 敵を倒す回数
item = defaultdict(int)

for i in range(n):
    a, b, c = map(int, input().split())
    item[a] += 1
    item[b] += 1
    item[c] += 1

remain_items = 0 # 同じアイテムを作れないものの個数
n_powerup = 0 # パワーアップ回数

for amount in item.values():
    n_powerup += amount // 2
    remain_items += amount % 2

n_powerup += remain_items // 4

print(n_powerup)
0