This post is all about the solution of the "A - Halloween Candy " TOYOTA MOTOR CORPORATION Programming Contest 2022 AtCoder Heuristic Contest 015 Problem Solution Statement.



AtCoder



Problem Statement :

Takahashi, CEO of AtCoder, is getting ready for Halloween later today. Takahashi will dressing up in mask and receive a candy bar from each AtCoder's 100 people by saying, "trick or treat!" He readies a square box that can hold a regular grid of 1010 pieces of candy, so each employee places a piece of candy in an empty space so that no candies intersect. There are three flavours of candies: blueberry, melon, and butternut. By questionnaire study, he understands which flavour of candy each employee will put in, but he will not really know in which each worker will put it. Because he is a neat freak, he will only move the candy by tilting the box forward, backward, left, or right before.



Format of Input :

Initially, the flavour of each candy piece is provided by Basic Input in the format shown below.

is a number among 1 and 3 that represents the flavour of the t-th candy piece.

Rehash the following procedures hundred times after having read the preceding information.

A single numeric p is used in the t-th process (1t100).

Basic Input provides a value between 1 and 101t. As shown in the instance figure below, we can number this same empty cells from 1 to 101t in front-to-back and left-to-right order. The t-th piece of candy is then positioned in the p

The -th vacant cell


Format of the Output :

The outcome should be accompanied by a new line, and Basic Outcome should be flushed.


Also Check this out:-



Also Read :- Top Programming Languages of 2022 Click Here

Solution of the Problem: Click Here