20240614

Spent time with my wife, drawing pictures of Jujutsu Kaisen together. I'm glad that there are hobbies we can share.

I've been (sort of) busy these days and could tackle problems with difficulty 800, but I better check problems with difficulty 900.

1956B. Nene and the Card Game

Let's say, both players have exactly one card for each number 1..n

To create a pair, i.e, one player has two cards with the same number, one card from the first player and one card from the second player must be swapped, resulting in both players have one pair of the same number.

=> The numner of pairs I will have and the number of pairs Nene will have are the same.

Let's consider the remaining parts; I only have different numbers in hand.

My turn always goes first, and Nene always minimizes my score. How does she do? by avoiding selecting a number that is not public. <=> Nene will minimize my score by selecting the number I place right after my turn.

Then, I only get score from the same number pairs in my hand.

from collections import defaultdict


for _ in range(int(input())):
    n = int(input())
    a = list(map(int, input().split()))
    counter = defaultdict(int)
    for ai in a:
        counter[ai] += 1
    print(len([count for count in counter.values() if count == 2]))

Avocado 200 Chicken rice 500 Bagel 300 Yogurt 200 Lunchable 500

Total 1700 kcal

push ups


TODO:


index 20240613 20240615