結果

問題 No.29 パワーアップ
ユーザー ryo_n
提出日時 2020-06-23 21:54:44
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 5,000 ms
コード長 484 bytes
コンパイル時間 77 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-07-03 19:30:37
合計ジャッジ時間 1,613 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    ABC = [[int(x) for x in input().split()] for _ in range(N)]

    cnt = collections.Counter()

    for a, b, c in ABC:
        cnt[a] += 1
        cnt[b] += 1
        cnt[c] += 1

    ans = 0
    mod = 0
    for k in cnt.keys():
        ans += cnt[k] // 2
        mod += cnt[k] % 2

    print(ans + mod // 4)


    

if __name__ == '__main__':
    main()

0