## SAC '22 Code Challenge 4 Junior P2 - Obligatory Geometry Problem

View as PDF

Points: 3 (partial)
Time limit: 1.0s
Memory limit: 256M

Author:
Problem type

After being bored for too long, Wesley has decided to set another geometry problem!

This time, however, it is solvable by people that do not have a -line polygon template.

Wesley will ask you queries of different types for polygons:

• set square i: Set the element to a square.

• set circle i: Set the element to a circle.

• set triangle i: Set the element to a triangle.

• get square i: Output 1 if the element is a square or a 0, otherwise.

• get circle i: Output 1 if the element is a circle or a 0, otherwise.

• get triangle i: Output 1 if the element is a triangle or a 0, otherwise.

Initially, all polygons are rhombuses and return 0 for all get queries.

Can you solve Wesley's obsession with geometry?

#### Input Specification

The first line will contain and , the number of polygons and queries, respectively.

The next lines will contain one of the queries above.

#### Output Specification

For each get query, output 1 if the polygons are the same; otherwise, output 0.

#### Sample Input 1

1 5
get square 1
set square 1
get square 1
set circle 1
get triangle 1

#### Sample Output 1

0
1
0

#### Sample Input 2

3 6
set square 2
set triangle 1
get square 2
set circle 3
get circle 3
get triangle 1

#### Sample Output 2

1
1
1