Vampiric politicians

In a country far away, some politicians seem to be eternal. After a
thorough study, the reason has finally been found out: they are
vampires. The cementery where they rest has been located. Can you help
to exterminate as many of them as possible, by thrusting a long silver
pike vertically through the ground?

0.57 For simplicity, let us consider a two-dimensional world. For each
vampire, we know the beginning and the end of its body when resting
horizontally in its tomb. All the vampires rest at diferent depths,
which are irrelevant.

To the right you can see the first case of the sample. When the four
vampires are resting, we can happily kill them all.

0.40

(12,7)

(0,0)(12,0)(12,5)(0,5)

(1,1)(9,1)(9,1.2)(1,1.2)

(3,3)(6,3)(6,3.2)(3,3.2)

(5,2)(11,2)(11,2.2)(5,2.2)

(4,4)(7,4)(7,4.2)(4,4.2)

(5.5,6)(5.5,-1)

Input

Input consists of several cases. Each case starts with the number of
vampires n. Follow n triples s_(i), ℓ_(i), r_(i), with the name, the
left extreme and the right extreme of each vampire when resting. You can
assume 1 ≤ n ≤ 10⁴, that all s_(i) are different and made up of between
1 and 12 lowercase letters, and 0 ≤ ℓ_(i) < r_(i) ≤ 10⁹.

Follow between 1 and 10⁵ names of vampires. Initially, the cemetery is
empty. Each given name s indicates that the vampire s enters the
cementery if s was not already there, or that s leaves the cemetery
otherwise. The word “END” marks the end of each case.

Output

After each given vampire name s, print the maximum number of vampires
that could be killed at that moment. Print a line with 10 dashes at the
end of each case.

Problem information

Author: Salvador Roura

Generation: 2026-01-25T10:39:47.848Z

© Jutge.org, 2006–2026.
https://jutge.org
