Back To School '16: Paradox
View as PDFYou 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  commands, each in the following 4 forms:
1 Einsert elementEinto the set. Printtrueorfalsedepending on whether or not the element was successfully inserted (did it not exist in the set before?).2 Eerase elementEfrom the set. Printtrueorfalsedepending on whether or not the element was successfully erased (did it exist in the set before?).3 Efind elementEin the set. Print the index of the element within the set (0-indexed). If the element does not exist, print-1.4print the elements in increasing order (false<true).
E will be either true or false.
Input Specification
Output Specification
For each command, print a single line of output.
Sample Input
5
1 true
2 false
3 false
1 false
4
Sample Output
true
false
-1
true
false true
Comments
there can be a maxinmum of 1 true and 1 false in the set? is that what "(did it not exist in the set before?)." means?
When you attempt to insert a value, print
trueif the set didn't have that value before, otherwise printfalse.Picky input, I also overcomplicated this :P
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 facepalmI believe its a newline, about to find out for myself
I way over complicated this and p1...