Editorial for COCI '15 Contest 7 #1 Nizovi
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.
Let's assume that empty arrays don't exist. Then, for each character {
, }
, ,
and letter of the English alphabet, we can define a set of commands to execute:
- Character
{
:- Print
{
and a newline - Increase current indentation by
- Indent
- Print
- Character
}
:- Print a newline
- Decrease current indentation by
- Indent
- Print
}
- Character
,
:- Print
,
and a newline - Indent
- Print
- Letter
Additionally, we'd need to check the case when an array is empty and equal to {}
.
Comments