結果

問題 No.29 パワーアップ
ユーザー ioryyyyzioryyyyz
提出日時 2015-07-25 04:45:10
言語 Python2
(2.7.18)
結果
AC  
実行時間 14 ms / 5,000 ms
コード長 493 bytes
コンパイル時間 436 ms
使用メモリ 6,624 KB
最終ジャッジ日時 2023-02-12 12:20:27
合計ジャッジ時間 2,129 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 13 ms
6,584 KB
testcase_01 AC 13 ms
6,624 KB
testcase_02 AC 13 ms
6,392 KB
testcase_03 AC 13 ms
6,512 KB
testcase_04 AC 13 ms
6,380 KB
testcase_05 AC 14 ms
6,400 KB
testcase_06 AC 13 ms
6,380 KB
testcase_07 AC 13 ms
6,448 KB
testcase_08 AC 13 ms
6,396 KB
testcase_09 AC 13 ms
6,384 KB
testcase_10 AC 13 ms
6,520 KB
testcase_11 AC 13 ms
6,384 KB
testcase_12 AC 13 ms
6,384 KB
testcase_13 AC 13 ms
6,560 KB
testcase_14 AC 13 ms
6,396 KB
testcase_15 AC 13 ms
6,396 KB
testcase_16 AC 13 ms
6,396 KB
testcase_17 AC 13 ms
6,376 KB
testcase_18 AC 13 ms
6,376 KB
testcase_19 AC 13 ms
6,380 KB
testcase_20 AC 13 ms
6,508 KB
testcase_21 AC 13 ms
6,396 KB
権限があれば一括ダウンロードができます

ソースコード

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