Back to School '16: Paradox

View as PDF

Submit solution


Points:5
Time limit:1.0s
Memory limit:256M
Author:

Problem type

You are in English class and learning about paradoxen. Unbeknownst to the teacher, the set<bool> data structure is incredibly useful to determine whether or not a situation/statement is a paradox. Implement a set<bool> interface for your teacher!

You are given C commands, each in the following 4 forms:

  1. 1 E insert element E into the set. Print true or false depending on whether or not the element was successfully inserted (did it not exist in the set before?).
  2. 2 E erase element E from the set. Print true or false depending on whether or not the element was successfully erased (did it exist in the set before?).
  3. 3 E find element E in the set. Print the index of the element within the set (0-indexed). If the element does not exist, print -1.
  4. 4 print the elements in increasing order. (false\le true)

For each command, print a single line of output. E will be either true or false.

Input Specification

1 \le C \le 100

Sample Input

5
1 true
2 false
3 false
1 false
4

Sample Output

true
false
-1
true
false true

Comments


  • -1
    ThePenguinCo
     commented on Sept. 17, 2016
    Picky input

    Picky input, I also overcomplicated this :P


  • 0
    paydayzcool
     commented on Sept. 16, 2016 edited
    What if the set is empty and the input is "4"?

    What if the set is empty and the input is "4"? Do I put a newline or just nothing?

    EDIT: nvm I solved it. I missed the print("true") on one of the lines facepalm


    • 0
      println_hi_
       commented on Oct. 15, 2016

      I believe its a newline, about to find out for myself


  • 2
    jlsajfj
     commented on Sept. 16, 2016
    Well

    I way over complicated this and p1...