Recently Added TSSOJ Problemshttps://tssoj.ca/The latest problems added on the Thornhill Secondary School Online Judge websiteen-caThu, 11 Jul 2024 17:23:28 +0000Best Fishing Spothttps://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...Thu, 11 Jul 2024 17:23:28 +0000https://tssoj.ca/problem/bestfishingspotTCCC '24 June P5 - Transfer Windowhttps://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...Fri, 14 Jun 2024 18:35:00 +0000https://tssoj.ca/problem/tccc24jun5TCCC '24 June P4 - Jungle Escapehttps://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 ...Fri, 14 Jun 2024 18:35:00 +0000https://tssoj.ca/problem/tccc24jun4TCCC '24 Apr P2 - Usernamxxxehttps://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...Fri, 26 Apr 2024 04:00:00 +0000https://tssoj.ca/problem/tccc24apr2TCCC '24 Apr P3 - Soaring Skylineshttps://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\...Fri, 26 Apr 2024 04:00:00 +0000https://tssoj.ca/problem/tccc24apr3TCCC '24 Apr P5 - Perfect Measurementshttps://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...Fri, 26 Apr 2024 04:00:00 +0000https://tssoj.ca/problem/tccc24apr5TCCC '24 Apr P1 - Taxes, taxes!https://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>
</...Fri, 26 Apr 2024 04:00:00 +0000https://tssoj.ca/problem/tccc24apr1TCCC '24 Apr P6 - File Mayhemhttps://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</...Fri, 26 Apr 2024 04:00:00 +0000https://tssoj.ca/problem/tccc24apr6TCCC '24 Apr P4 - Egg Hunthttps://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...Fri, 26 Apr 2024 04:00:00 +0000https://tssoj.ca/problem/tccc24apr4CCC '24 S2 - Heavy-Light Compositionhttps://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...Mon, 04 Mar 2024 05:00:00 +0000https://tssoj.ca/problem/ccc24s2CCC '24 S1 - Hat Circlehttps://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...Mon, 04 Mar 2024 05:00:00 +0000https://tssoj.ca/problem/ccc24s1CCC '24 J5 - Harvest Waterloohttps://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 ...Mon, 04 Mar 2024 05:00:00 +0000https://tssoj.ca/problem/ccc24j5CCC '24 J4 - Troublesome Keyshttps://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...Mon, 04 Mar 2024 05:00:00 +0000https://tssoj.ca/problem/ccc24j4CCC '24 J3 - Bronzehttps://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...Mon, 04 Mar 2024 05:00:00 +0000https://tssoj.ca/problem/ccc24j3CCC '24 J2 - Dusa And The Yobishttps://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...Mon, 04 Mar 2024 05:00:00 +0000https://tssoj.ca/problem/ccc24j2CCC '24 J1 - Conveyor Belt Sushihttps://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...Mon, 04 Mar 2024 05:00:00 +0000https://tssoj.ca/problem/ccc24j1TCCC '24 Feb P3 - Snowy Dayshttps://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 ...Fri, 16 Feb 2024 05:00:00 +0000https://tssoj.ca/problem/tccc24feb3TCCC '24 Apr P7 - Hyper Magnethttps://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 ...Fri, 16 Feb 2024 05:00:00 +0000https://tssoj.ca/problem/tccc24apr7TCCC '24 Feb P1 - Morning Routinehttps://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...Fri, 16 Feb 2024 05:00:00 +0000https://tssoj.ca/problem/tccc24feb1TCCC '24 Feb P4 - Good Giftshttps://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...Fri, 16 Feb 2024 05:00:00 +0000https://tssoj.ca/problem/tccc24feb4TCCC '24 Feb P5 - Mars Adventurehttps://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...Fri, 16 Feb 2024 05:00:00 +0000https://tssoj.ca/problem/tccc24feb5TCCC '24 Feb P2 - Mountain Misfortunehttps://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>...Thu, 15 Feb 2024 17:38:01 +0000https://tssoj.ca/problem/tccc24feb2TCCC '23 Dec P3 - Escaping The Mineshttps://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...Fri, 22 Dec 2023 07:35:00 +0000https://tssoj.ca/problem/tccc23dec3TCCC' 23 Dec P4 - The Bronze Christmas Treehttps://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...Mon, 18 Dec 2023 16:40:18 +0000https://tssoj.ca/problem/tccc23dec4TCCC '23 Dec P2 - Grinchinghttps://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...Sun, 10 Dec 2023 00:53:44 +0000https://tssoj.ca/problem/tccc23dec2