Editorial for SAC '22 Code Challenge 4 Junior P2 - Obligatory Geometry Problem
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Subtask 1
It suffices to maintain a string that stores the type of the current shape:
If it is a
set
query, update the string to that shape.If it is a
get
query, output1
if the string and query shape are the same and output0
, otherwise.
Time Complexity:
Subtask 2
Extend the subtask solution by giving each of the shapes a string by defining an array.
Further, maintain the string for each of the shapes:
If it is a
set
query, update the string at index to that shape.If it is a
get
query, output1
if the string at index and query shape are the same and output0
, otherwise.
Time Complexity:
Comments