We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
(_, A) = (
raw_input(),
set(map(int, raw_input().split()))
)
for _ in xrange(input()):
(command, newSet) = (
raw_input().split()[0],
set(map(int, raw_input().split()))
)
# Cool trick. Since our commands are method names, just
# execute the method on A with our new set as its argument.
getattr(A, command)(newSet)
print str(sum(A))
Set Mutations
You are viewing a single comment's thread. Return to all comments →
I liked this solution better than the editorial: