0
0

More than 1 year has passed since last update.

ABC73 C - Write and Erase を解いた

Posted at

abc73_1.png
abc73_2.png
abc73_3.png

配列を 10^9 用意して
True,False で最終的な True を数えようと思った。
だがしかし Memory error.

じゃあ辞書 or collection counter で
A の要素を数えて偶数 or 奇数で判断するしかないな。

WriteAndErase.py
N = int(input())
dic = {}

for _ in range(N):
    a = int(input())
    if a not in dic:
        dic[a] = 0
    dic[a] += 1

cnt = 0
for i in dic.keys():
    if dic[i]%2 != 0:
        cnt += 1

print(cnt)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0