結果

問題 No.29 パワーアップ
ユーザー ksomemo
提出日時 2017-10-05 22:14:27
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 27 ms / 5,000 ms
コード長 409 bytes
コンパイル時間 508 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-11-16 21:31:04
合計ジャッジ時間 2,087 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
from itertools import chain


def main():
    N = int(input())

    gen = (input().split() for _ in range(N))
    c = Counter(chain.from_iterable(gen))

    n_up = 0
    total_rem = 0
    for count in c.values():
        quotient, rem = divmod(count, 2)
        n_up += quotient
        total_rem += rem

    print(n_up + total_rem // 4)

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