One of the many reasons why SAPO is the best informatics Olympiad is that we're allowed to submit solutions in Scratch (TianCilliers wrote a CMS plugin to support Scratch a while ago)
The second round of SAPO 2020 was held earlier this week, so obviously I had to try to solve the problems using Scratch.
The problems were:
- Given
X
,Y
, andN
, outputN / X + N / Y - N / lcm(X, Y)
. - Add two given numbers in base
B
for a givenB
. - This problem but modulo 1e8.
- Given a tree and some paths, find the number of edges in the union of those paths.
I was able to solve the first and third problems this way:
but I couldn't implement the second and fourth problems.
As you can see in the code for problem 3, working with multiple arrays is a bit of a nightmare.
I feel like problem 2 is solvable using Scratch (albeit very painfully), but since Scratch doesn't have 2D arrays, I don't see how one could solve problem 4 using Scratch.
Do any of you have ideas about how one can work with graphs using Scratch?
(P.s. my other Scratch implementations are available at https://github.com/dolphingarlic/ScrAtChO)