結果

問題 No.29 パワーアップ
ユーザー dango
提出日時 2023-06-05 15:25:01
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 5,000 ms
コード長 460 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-12-29 06:08:56
合計ジャッジ時間 1,746 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

def MAX(N, items):
    counts = [0] * 10
    power_ups = 0
    for item_set in items:
        for item in item_set:
            counts[item - 1] += 1
            if counts[item - 1] == 2:
                power_ups += 1
                counts[item - 1] = 0
    total_items = sum(counts)
    power_ups += total_items // 4
    return power_ups
N = int(input())
items = []
for _ in range(N):
    items.append(tuple(map(int, input().split())))
print(MAX(N, items))
0