結果

問題 No.29 パワーアップ
ユーザー 141sksk
提出日時 2019-08-20 21:36:55
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 30 ms / 5,000 ms
コード長 538 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-06 16:09:10
合計ジャッジ時間 1,539 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
  
    n = int(input())
    itemList = []
    count = 0
    for _ in range(n):
        items = list(map(int, input().split()))
        itemList += items
    itemCount = len(itemList)
    for i in range(1, 11):
        amount = itemList.count(i)
        if amount % 2 == 0:
            count += amount / 2
            itemCount -= amount
        elif amount >= 3:
            count += amount // 2
            itemCount -= (amount - 1)
    count += itemCount // 4
    print(int(count))
    
if __name__ == "__main__":
    main()
0