結果

問題 No.29 パワーアップ
ユーザー ksomemoksomemo
提出日時 2017-10-05 22:14:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 19 ms / 5,000 ms
コード長 409 bytes
コンパイル時間 962 ms
コンパイル使用メモリ 10,720 KB
実行使用メモリ 8,648 KB
最終ジャッジ日時 2023-08-10 14:52:40
合計ジャッジ時間 2,380 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,424 KB
testcase_01 AC 17 ms
8,604 KB
testcase_02 AC 17 ms
8,420 KB
testcase_03 AC 17 ms
8,496 KB
testcase_04 AC 18 ms
8,420 KB
testcase_05 AC 18 ms
8,600 KB
testcase_06 AC 17 ms
8,472 KB
testcase_07 AC 17 ms
8,544 KB
testcase_08 AC 17 ms
8,612 KB
testcase_09 AC 18 ms
8,540 KB
testcase_10 AC 18 ms
8,636 KB
testcase_11 AC 17 ms
8,624 KB
testcase_12 AC 18 ms
8,600 KB
testcase_13 AC 19 ms
8,648 KB
testcase_14 AC 18 ms
8,528 KB
testcase_15 AC 17 ms
8,588 KB
testcase_16 AC 17 ms
8,640 KB
testcase_17 AC 17 ms
8,468 KB
testcase_18 AC 18 ms
8,428 KB
testcase_19 AC 18 ms
8,468 KB
testcase_20 AC 18 ms
8,460 KB
testcase_21 AC 18 ms
8,524 KB
権限があれば一括ダウンロードができます

ソースコード

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