結果

問題 No.29 パワーアップ
コンテスト
ユーザー dango
提出日時 2023-06-05 15:25:01
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 29 ms / 5,000 ms
コード長 460 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 12,288 KB
実行使用メモリ 10,240 KB
最終ジャッジ日時 2025-10-24 21:19:33
合計ジャッジ時間 1,427 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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