Recently Added TSSOJ Problemshttps://tssoj.ca/2024-07-11T17:23:28+00:00The latest problems added on the Thornhill Secondary School Online Judge websiteBest Fishing Spot2024-07-11T17:23:28+00:002024-07-11T17:23:28+00:00https://tssoj.ca/problem/bestfishingspot<p>There are \(n\) fish swimming back and forth on an integer number line. The movements of each fish \(f_1, f_2, ..., f_n\) can be described by a pair of integers \(f_i = (h_i, r_i)\) where \(h_i\) represents that fish's home and \(r_i\) represents the number of units in each direction from their home that they will reach by swimming. For example, if a fish is described by \((-1, 5)\) then they live at \(-1\) and reach anywhere in \([-6, 4]\) on the number line.</p>
<p>We are interested in find...TCCC '24 June P5 - Transfer Window2024-06-14T18:35:00+00:002024-06-14T18:35:00+00:00https://tssoj.ca/problem/tccc24jun5<p><strong>Thornhill Computer Club 2024 - June Contest - Problem 5</strong></p>
<p>After winning the TCC (The Champions Cup), Real Chamartin is looking to buy new players. However, due to MF (Monetary Fairness), the club can only purchase a player once their earnings are at least equivalent to the price.</p>
<p>The club's earnings are represented by a list of \(N\) \((N \le 1000)\) integers, where \(a_i\) \((0 \le a_i)\) represents the earnings on day \(i\) \((1 \le i \le N)\). Information about...TCCC '24 June P4 - Jungle Escape2024-06-14T18:35:00+00:002024-06-14T18:35:00+00:00https://tssoj.ca/problem/tccc24jun4<p><strong>Thornhill Computer Club 2024 - June Contest - Problem 4</strong></p>
<p>An explorer has found himself deep in the jungle in Mexico, and needs to escape as fast as possible. However, because his companion, Wason, is a troll, the explorer needs to determine the amount of time to reach any of the exits, in case Wason rejects the others. The jungle is represented by a \(N\) by \(M\) grid, where the explorer can move up, right, down, and left.</p>
<p>Each cell of the grid is either a path ...TCCC '24 Apr P2 - Usernamxxxe2024-04-26T04:00:00+00:002024-04-26T04:00:00+00:00https://tssoj.ca/problem/tccc24apr2<p><strong>Thornhill Computer Club 2024 - April Contest - Problem 2</strong></p>
<p>While typing out a cool username to use for the popular game League of Legends, [user:alan11] was unfortunately hit by a rock which caused him to type gibberish. He desired to have a bunch of <strong>capital</strong> <code>X</code>'s at the front of his username but they ended up in random places due to the impact. Write a program that removes all <code>X</code>'s in a given string of length \(L\) \((10 \le L \l...TCCC '24 Apr P3 - Soaring Skylines2024-04-26T04:00:00+00:002024-04-26T04:00:00+00:00https://tssoj.ca/problem/tccc24apr3<p><strong>Thornhill Computer Club 2024 - April Contest - Problem 3</strong></p>
<p>City skylines are always scenic to look at! Write a program that draws a city skyline using the <code>*</code> character given the number of buildings the skyline contains and the dimensions of each building.</p>
<h4>Input Specifications</h4>
<p>The first line of input will consist of the integer \(N\) \((1 \le N \le 10^3)\), representing the number of buildings the city skyline will contain.</p>
<p>The next \(N\...TCCC '24 Apr P5 - Perfect Measurements2024-04-26T04:00:00+00:002024-04-26T04:00:00+00:00https://tssoj.ca/problem/tccc24apr5<p><strong>Thornhill Computer Club 2024 - April Contest - Problem 5</strong></p>
<p>[user:krem] is baking a large cake that requires \(N\) \((1 \le N \le 5 \cdot 10^4)\) cups of flour. However, all the markings on his \(M\) \((1 \le 50)\) measurement devices have been erased, leaving him unable to measure precise amounts of flour. Luckily, [user:krem] knows the \(i\)th measuring device can hold \(C_i\) \((1 \le i \le M)\) cups of flour when completely filled. Instead of buying new measuring devi...TCCC '24 Apr P1 - Taxes, taxes!2024-04-26T04:00:00+00:002024-04-26T04:00:00+00:00https://tssoj.ca/problem/tccc24apr1<p><strong>Thornhill Computer Club 2024 - April Contest - Problem 1</strong></p>
<p>An odd country taxes customers in stores for buying certain amounts of items, in order to encourage bulk buying:</p>
<table class="table">
<thead><tr>
<th>Number <strong>different</strong> of items</th>
<th>Tax cost</th>
</tr>
</thead>
<tbody>
<tr>
<td>1 only</td>
<td>$2</td>
</tr>
<tr>
<td>2 or 3</td>
<td>$1</td>
</tr>
<tr>
<td>4 or 5</td>
<td>$0.5</td>
</tr>
<tr>
<td>6 or more</td>
<td>$0</td>
</tr>
</tbody>
</...TCCC '24 Apr P6 - File Mayhem2024-04-26T04:00:00+00:002024-04-26T04:00:00+00:00https://tssoj.ca/problem/tccc24apr6<p><strong>Thornhill Computer Club 2024 - April Contest - Problem 6</strong></p>
<p>[user:KurbyDoo] really <strong>really</strong> likes to hoard all his files! Although he told himself he would delete useless ones to free up space later on, he never ended up doing so and now he doesn't have a single megabyte of storage left to download the next civ update! Thankfully, [user:KurbyDoo] marked all the files and folders he wanted to get rid of with the words <code>delete</code> or <code>temporary</...TCCC '24 Apr P4 - Egg Hunt2024-04-26T04:00:00+00:002024-04-26T04:00:00+00:00https://tssoj.ca/problem/tccc24apr4<p>Easter has come (past lol)! To celebrate, [user:QuantumFlare]'s parents are holding their yearly egg hunt as always. In each room of the house, they hide chocolate eggs that may or may not be reachable behind and around impassible obstacles. [user:QuantumFlare]. Being a big fan of chocolate, he has decided to efficiently and methodically search each room of the house to find as many eggs as he can. Starting in the top left corner of each room (0,0), he can walk either up, down, left, or right...CCC '24 S2 - Heavy-Light Composition2024-03-04T05:00:00+00:002024-03-04T05:00:00+00:00https://tssoj.ca/problem/ccc24s2<p><strong>Canadian Computing Competition: 2024 Stage 1, Senior #2</strong></p>
<p>In a string containing only lowercase letters of the alphabet (<code>a</code> through <code>z</code>), we say a letter is heavy if it appears more than once in the string, and light otherwise.</p>
<p>We will be given a number of strings. For each string, we would like to determine whether the letters of the string alternate between light and heavy.</p>
<h4>Input Specification</h4>
<p>The first line of input will c...CCC '24 S1 - Hat Circle2024-03-04T05:00:00+00:002024-03-04T05:00:00+00:00https://tssoj.ca/problem/ccc24s1<p><strong>Canadian Computing Competition: 2024 Stage 1, Senior #1</strong></p>
<p>At a recent social gathering, \(N\) people sit around a circular table, where \(N\) is even. The seats are numbered clockwise from \(1\) to \(N\). Each person is wearing a hat with a number on it. Specifically, the person at seat \(i\) is wearing a hat with the number \(H_{i}\) on it.</p>
<p>Each person looks at the person who is directly across (diametrically opposite) them in the circle.</p>
<p>Determine the num...CCC '24 J5 - Harvest Waterloo2024-03-04T05:00:00+00:002024-03-04T05:00:00+00:00https://tssoj.ca/problem/ccc24j5<p><strong>Canadian Computing Competition: 2024 Stage 1, Junior #5</strong></p>
<p>There is a wildly popular new harvest simulation game called Harvest Waterloo. The game is played on a rectangular pumpkin patch which contains bales of hay and pumpkins of different sizes. To begin the game, a farmer is placed at the location of a pumpkin.</p>
<p>The farmer harvests all pumpkins they can reach by moving left, right, up, and down throughout the patch. The farmer cannot move diagonally. The farmer ...CCC '24 J4 - Troublesome Keys2024-03-04T05:00:00+00:002024-03-04T05:00:00+00:00https://tssoj.ca/problem/ccc24j4<p><strong>Canadian Computing Competition: 2024 Stage 1, Junior #4</strong></p>
<p>As Alex is typing, their keyboard is acting strangely. Two letter keys are causing trouble:</p>
<ul>
<li>One letter key displays the same wrong letter each time it is pressed. Alex calls this key the silly key. Oddly, Alex never actually tries to type the wrong letter displayed by the silly key.</li>
<li>Another letter key doesn't display anything when it is pressed. Alex calls this key the quiet key.
Alex presses...CCC '24 J3 - Bronze2024-03-04T05:00:00+00:002024-03-04T05:00:00+00:00https://tssoj.ca/problem/ccc24j3<p><strong>Canadian Computing Competition: 2024 Stage 1, Junior #3</strong></p>
<p>After completing a competition, you are struck with curiosity. How many participants were awarded bronze level?</p>
<p>Gold level is awarded to all participants who achieve the highest score. Silver level is awarded to all participants who achieve the second highest score. Bronze level is awarded to all participants who achieve the third highest score.</p>
<p>Given a list of all the scores, your job is to determin...CCC '24 J2 - Dusa And The Yobis2024-03-04T05:00:00+00:002024-03-04T05:00:00+00:00https://tssoj.ca/problem/ccc24j2<p><strong>Canadian Computing Competition: 2024 Stage 1, Junior #2</strong></p>
<p>Dusa eats Yobis, but only Yobis of a certain size.</p>
<p>If Dusa encounters a Yobi that is smaller than itself, it eats the Yobi, and absorbs its size. For example, if Dusa is of size \(10\) and it encounters a Yobi of size \(6\), Dusa eats the Yobi and expands to size \(10 + 6 = 16\).</p>
<p>If Dusa encounters a Yobi that is the same size as itself or larger, Dusa runs away without eating the Yobi.</p>
<p>Dusa i...CCC '24 J1 - Conveyor Belt Sushi2024-03-04T05:00:00+00:002024-03-04T05:00:00+00:00https://tssoj.ca/problem/ccc24j1<p><strong>Canadian Computing Competition: 2024 Stage 1, Junior #1</strong></p>
<p>There is a new conveyor belt sushi restaurant in town. Plates of sushi travel around the restaurant on a raised conveyor belt and customers choose what to eat by removing plates.</p>
<p>Each red plate of sushi costs \($3\), each green plate of sushi costs \($4\), and each blue plate of sushi costs \($5\).</p>
<p><img src="https://static.dmoj.ca/media/martor/d70c57cc-648a-494a-a713-d20f5163ce96.png" alt="Plates of...TCCC '24 Feb P3 - Snowy Days2024-02-16T05:00:00+00:002024-02-16T05:00:00+00:00https://tssoj.ca/problem/tccc24feb3<p><strong>Thornhill Computer Club 2024 - February Mock CCC - Problem 3</strong></p>
<p>Joe likes to go sledding. Of course, to go sledding, there must be snow. On any given day, snow will form if the temperature is below <code>0</code> degrees Celsius and the humidity is above <code>70</code> percent. However, Joe is an elitist sledder and will only go sledding if there is sufficient snow. Specifically, he will only go sledding on a given day if it has been snowing for at least two consecutive ...TCCC '24 Apr P7 - Hyper Magnet2024-02-16T05:00:00+00:002024-02-16T05:00:00+00:00https://tssoj.ca/problem/tccc24apr7<p><strong>Thornhill Computer Club 2024 - April Contest - Problem 7</strong></p>
<p>The Thornhill Science Society have created a revolutionary new piece of magnetic technology: The Hyper Magnet. The Hyper Magnet operates within a unique framework: it can dynamically change its polarity to positive, negative, or neutral, depending on if the number of polar pairs between surrounding objects. A polar pair exists between two objects \(i\) and \(j\) if the sum of their polarity is less than or equal ...TCCC '24 Feb P1 - Morning Routine2024-02-16T05:00:00+00:002024-02-16T05:00:00+00:00https://tssoj.ca/problem/tccc24feb1<p><strong>Thornhill Computer Club 2024 - February Mock CCC - Problem 1</strong></p>
<p>[user:KurbyDoo] always stays up late and can never fall asleep on time. As a result, he often wakes up late for school causing him to skip breakfast and even potentially <strong>miss the bus</strong> which always arrives exactly <strong>8 hours after midnight</strong>. Aware of his problem, he decides to plan his morning routine accordingly depending on when he wakes up. It takes <code>5</code> minutes for hi...TCCC '24 Feb P4 - Good Gifts2024-02-16T05:00:00+00:002024-02-16T05:00:00+00:00https://tssoj.ca/problem/tccc24feb4<p><strong>Thornhill Computer Club 2024 - February Mock CCC - Problem 4</strong></p>
<p>During a party, people exchange gifts. Every person has written their favourite number on the gifts that they will give. If the sum of the numbers of the gifts exchanged between two people is prime, their exchange is considered a good exchange. Every person can give infinitely many gifts, but any pair of two people may only exchange their gifts once.</p>
<p>Given the number of people at the party and their fa...TCCC '24 Feb P5 - Mars Adventure2024-02-16T05:00:00+00:002024-02-16T05:00:00+00:00https://tssoj.ca/problem/tccc24feb5<p><strong>Thornhill Computer Club 2024 - February Mock CCC - Problem 5</strong></p>
<p>[user:EthanPacker] has made it to Mars! After spending many days aboard his rocket, he has finally touched down and deployed his rover to explore the Martian surface. However, Mars is a hostile planet with different terrains requiring a different amount of energy to cross. What makes matters even worse, is that [user:EthanPacker] forgot to charge the rover before blasting off! Given multiple queries, determin...TCCC '24 Feb P2 - Mountain Misfortune2024-02-15T17:38:01+00:002024-02-15T17:38:01+00:00https://tssoj.ca/problem/tccc24feb2<p><strong>Thornhill Computer Club 2024 - February Mock CCC - Problem 2</strong></p>
<p>[user:KurbyDoo] is climbing up a mountain. Unfortunately he tripped over a rock and is now tumbling down! As he falls, he hits rocks on the way down and each time he does, he screams "OUCH". [user:krem] finds [user:KurbyDoo]'s predicament extremely funny and decides to record the audio. Watching the file back, determine how many times [user:KurbyDoo] hit a rock while falling.</p>
<h4>Input Specifications</h4>...TCCC '23 Dec P3 - Escaping The Mines2023-12-22T07:35:00+00:002023-12-22T07:35:00+00:00https://tssoj.ca/problem/tccc23dec3<p><strong>Thornhill Computer Club 2023 - December Contest - Problem 3</strong></p>
<p>In the last chronological problem, the Elves were hard at work trying to find all of the mine's coal and mine it as fast as possible. After a long time of mining, the Elves notice that they are mining more coal than anywhere else in the world. Not wanting to provide lumps of coal to all the naughty children, the Elves start a worker's revolt throughout Santa's Arctic coal mine so they can reap the profits of s...TCCC' 23 Dec P4 - The Bronze Christmas Tree2023-12-18T16:40:18+00:002023-12-18T16:40:18+00:00https://tssoj.ca/problem/tccc23dec4<div style="float:right; width:400px; padding: 10px 10px">
<img src="https://imgs.xkcd.com/comics/tree.png" style="display: block; margin: 0 auto; width:100%;">
<div style="text-align:center;font-style:italic;margin-top:0.5em"><a href="http://xkcd.com/835/" title="a" rel="nofollow">The Average Christmas Tree</a></div></div><p>With 2.9 million beautiful grins on 2.9 million proud elves standing at the front gates of Santa's present factory, What was once a place of terror and monotonous labour is...TCCC '23 Dec P2 - Grinching2023-12-10T00:53:44+00:002023-12-10T00:53:44+00:00https://tssoj.ca/problem/tccc23dec2<p><strong>Thornhill Computer Club 2023 - December Contest - Problem 1</strong></p>
<blockquote><p><em>The 30th of November by The Ministry of Elvish Affairs</em><br>
`Twas the season once more, proclaimed Saint Nick bold, Through the elf village, his voice mighty and old.<br>
Conscripting young elves, six and above, For the Christmas crunch, a mission of love.</p>
<p>Unaware was dear Santa, of the plot in the air, A local elf youth grinned with a mischievous stare.<br>
A grand "Grinching" schem...