POJ C + + program programming problem # # # Set Programming Job-STL2

Source: Internet
Author: User
Programming Problem #3:set

Source: POJ (Coursera statement: The exercises completed on POJ will not count against the final results of Coursera. )

Note: Total time limit: 5000ms memory limit: 100000kB

Describe

An entire set of existing integers (with duplicate elements allowed), initially empty. We define the following actions:

Add x to add X to the collection

Del x removes all elements in the collection that are equal to X

Ask x query for the case of element x in the collection

For each of these operations, we require the following output.

The number of x in the collection after the Add output operation

The number of x in the collection before the DEL output operation

Ask first outputs 0 or 1 to indicate if X has ever been added to the collection (0 means it has not been added), and then outputs the number of x in the current set, with an empty opening in the middle.

Input

The first line is an integer n, which represents the number of commands. 0<=n<=100000.

The following n-line command, as described in description.

Output

A total of n rows, each line output as required.

Sample input
7add 1add 1ask 1ask 2del 2del 1ask 1
Sample output
121 20 0021 0
Tips

Please use STL's set and multiset to finish the task

POJ C + + program programming problem # # # Set Programming Job-STL2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.