結果

問題 No.29 パワーアップ
ユーザー ioryyyyz
提出日時 2015-07-25 04:45:10
言語 Python2
(2.7.18)
結果
AC  
実行時間 17 ms / 5,000 ms
コード長 493 bytes
コンパイル時間 400 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-16 04:38:37
合計ジャッジ時間 1,794 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python
# -*- coding:utf-8 -*-

from collections import defaultdict

def main():
    N = input()
    d = defaultdict(int)
    for _ in range(N):
        a, b, c = map(int, raw_input().split())
        d[a] += 1
        d[b] += 1
        d[c] += 1
    powerup_cnt = 0
    remain_items = 0
    for index in d:
        powerup_cnt += d[index] / 2
        remain_items += d[index] % 2
    powerup_cnt += remain_items / 4
    print(powerup_cnt)

if __name__ == "__main__":
    main()
0