Recently Added MCPT Problemshttps://mcpt.ca/2020-05-31T23:24:05.754861+00:00The latest problems added on the MCPT's Online Judge websitehewmatt10's Dream2020-05-31T23:24:05.754861+00:002020-05-31T23:24:05.754861+00:00https://mcpt.ca/problem/ellipse<p>[user:hewmatt10] is dreaming about <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ" rel="nofollow"><span style="color:black">[REDACTED]</span></a>! In his dream, <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ" rel="nofollow"><span style="color:black">[REDACTED]</span></a> appears $$N$$ times on the 2D plane, at $$N$$ different points. Because [user:hewmatt10] likes round objects, all of the $$N$$ points appear on an ellipse centred at $$(0, 0)$$ with its semi-major and semi-minor a...Distances2020-05-31T23:23:56.579062+00:002020-05-31T23:23:56.579062+00:00https://mcpt.ca/problem/dist<p>Given an array of length $$N$$ and $$Q$$ queries, print the closest number to the value given in each query.</p> <h4>Input Specification</h4> <p>The first line will contain integer $$N$$ $$(1 \leq N \leq 10^5)$$ and $$Q$$ $$(1 \leq Q \leq 10^5)$$, the length of the array and the number of queries, respectively. The next line will contain $$N$$ integers, the values in the array. It is guaranteed that these values will be smaller than $$10^9$$. The next $$Q$$ lines will contain an integer $$a$$...Alan's Gold2020-05-31T23:23:49.855304+00:002020-05-31T23:23:49.855304+00:00https://mcpt.ca/problem/alansgold<p>Alan has recently made a deal with a Nigerian prince, and is now faced with $$N$$ boxes full of gold. The boxes are equally distant from each other, with the $$N^{th}$$ box closest to him. However he has not come prepared, and his truck only has space for 2 boxes of gold.</p> <p>Each of the boxes of gold has a value $$A_i$$, which is the value of the gold contained in it.</p> <p>Unfortunately, Alan is also extremely lazy, and the boxes with greater value are also heavier due to their higher ...A Times B2020-05-31T23:23:49.855304+00:002020-05-31T23:23:49.855304+00:00https://mcpt.ca/problem/atimesb<p>Given two numbers, $$A$$ and $$B$$, can you calculate $$A \times B$$?</p> <h4>Input Specification</h4> <p>The first line of input will have integer $$A (1 \leq A \leq 10^{10^5})$$.</p> <p>The first line of input will have integer $$B (1 \leq B \leq 10^{10^5})$$.</p> <h4>Output Specification</h4> <p>Output the product of $$A \times B$$.</p> <h4>Subtasks</h4> <h5>Subtask 1 [10%]</h5> <p>$$A \leq 10^5$$</p> <p>$$B \leq 10^5$$</p> <h5>Subtask 2 [20%]</h5> <p>$$A \leq 10^{1000}$$</p> <p>$$B \leq 1...Tootsie Rolls2020-05-23T18:16:11+00:002020-05-23T18:16:11+00:00https://mcpt.ca/problem/tootsierolls<p>Emili has decided to buy a literal tree to put in her bedroom! She wants to decorate it with \(N$$ pieces of candy, attached together with strings. Each piece of candy has a tastiness value of $$t_i$$ that Emili assigns it. Some candy, such as Tootsie rolls, are so bad that they have a negative tastiness value! There are exactly $$N-1$$ strings connecting the candy, and all pieces of candy are connected together by the strings. The candies are numbered from $$1$$ to $$N$$. Candy $$1$$ is at t...Maximum XOR Path2020-05-09T22:47:50+00:002020-05-09T22:47:50+00:00https://mcpt.ca/problem/xorpath<p>You are given a tree of $$N$$ nodes, and an integer $$K$$. Each node has a value $$v_i$$. Determine the maximum XOR-sum of the values of a path with length $$\geq K$$.</p> <p>Note the length of a path is defined as how many edges are on that path, not how many nodes are on it.</p> <p>We define the XOR-sum of a set of integers $$a$$ to be $$a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_k$$, where $$k$$ is the length of $$a$$.</p> <h4>Input Specification</h4> <p>The first line contains two i...Connect the Dots2020-05-09T22:47:31+00:002020-05-09T22:47:31+00:00https://mcpt.ca/problem/connectthedots<p>[user:hewmatt10] is playing connect the dots! Because he has no friends, he has to play connect the dots with himself. [user:hewmatt10] first starts with 1 dot on his canvas. Every turn, for $$T$$ turns, he does the following steps:</p> <ol> <li>First, choose a number $$C_i\ (3 \le C_i)$$.</li> <li>For every dot currently on the canvas (exclude new dots painted this turn), paint $$C_i - 1$$ new dots.</li> <li>Connect all of the new dots and the chosen dot such that they form a cycle of length...Megacities2020-05-09T22:47:22+00:002020-05-09T22:47:22+00:00https://mcpt.ca/problem/megacities<p>Your boss has left you in charge of $$N$$ cities with $$M$$ forests separating them. Each forest has a cost required to clear, and clearing a forest will merge the two cities it had once separated. He wants you to merge these $$N$$ cities into $$x$$ megacities, where the number of megacities satisfies $$x^2 - (N+1)*x + N = 0$$. What is the minimum cost required to complete the job? If there are two minimum solutions, find the larger one.</p> <h4>Input Specifications</h4> <p>The first line wil...Path Running2020-05-09T22:47:09+00:002020-05-09T22:47:09+00:00https://mcpt.ca/problem/run<p>Given an array of length $$N$$ and starting at the 1st index, determine if it is possible to end exactly on the last index of the array, each time moving to the right by $$K$$ spaces and with $$M$$ indexes that cannot be moved to.</p> <h4>Input Specification</h4> <p>The first line will contain the integer $$N$$ $$(1 \leq N \leq 10^5)$$, the length of the array, $$K$$ $$(1 \leq K \leq 10^5)$$, the amount of spaces you move to the right by each time, and $$M$$ $$(0 \leq M \leq N)$$, the number ...Evan's Cube2020-05-07T21:02:07+00:002020-05-07T21:02:07+00:00https://mcpt.ca/problem/evanscube<p>A Rubik's Cube is a 3-D combination puzzle. The cube consists of six faces, each of which is covered by nine stickers. The stickers are one of six solid colous: white, red, blue, orange, green, and yellow. Initially, the cube is "scrambled", meaning that each of the nine stickers on each face are a random colour. The goal of the Rubik's cube is to "solve" it, making each face of the cube one specific colour, through a series of rotations.</p> <p>There are exactly six faces to a Rubik's Cube. ...hewmatt10's Card2020-04-28T20:09:42+00:002020-04-28T20:09:42+00:00https://mcpt.ca/problem/circles<p>[user:hewmatt10] is making a birthday card for the love of his life, <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ" rel="nofollow"><span style="color:black">[REDACTED]</span></a>! However, because [user:hewmatt10] can't draw a heart, he has resorted to drawing a circle. [user:hewmatt10] wants to draw $$R$$ different concentric circles centred on $$(0, 0)$$, with the $$i^{th}$$ circle having a radius of $$\sqrt{i}$$. To do this, he needs to know all the integer-valued coordinates points...Bob & His Crops2020-04-28T20:09:39+00:002020-04-28T20:09:39+00:00https://mcpt.ca/problem/crops<p>Bob the farmer is harvesting potatoes from his long field of length N, filled with potatoes and carrots. Unfortunately, some pesky weeds have also grown in the field. Bob wants to harvest as many crops in a row, without harvesting any weeds. Can you output the number of potatoes and carrots he will harvest?</p> <p>If there are multiple answers, output the one earliest in the input.</p> <h4>Input Specification</h4> <p>The first line will contain one integer, $$N (1 \leq N \leq 10^6)$$, the len...An Easy Score2020-04-28T17:00:00+00:002020-04-28T17:00:00+00:00https://mcpt.ca/problem/minscore<p>[user:DepressoEspresso] is doing a contest!</p> <p>This contest has problems worth 1, 2, 5, 10, 20, 50, or 100 points. Given $$N$$ point goals for the contest, can you tell [user:DepressoEspresso] the minimum number of problems needed to get that exact score and the number of each type of problem that have to be solved?</p> <h4>Input Specification</h4> <p>The first line will contain integer $$N$$ $$(1 \leq N \leq 100)$$, the number of point goals for this contest.</p> <p>The next $$N$$ lines...Art Academy VII: A Mysterious Object2020-04-24T23:13:24.762968+00:002020-04-24T23:13:24.762968+00:00https://mcpt.ca/problem/art7<p><strong><em>[user:hewmatt10] has been captured!</em></strong></p> <p>After his army was defeated and his bunker discovered, he was found protecting a mysterious, password-protected box. [user:A_L_I_C_E_]'s interest now piqued, she decides to try and open it. Not much about [user:hewmatt10] was known other than the fact that his greatest enemy is <strong>hewmatt100</strong>.</p> <p>She now hypothesizes:</p> <blockquote><p>[user:hewmatt10] likes any integer $$X$$, where $$10$$ is a subsequence ...Art Academy VI: The Last Stand2020-04-24T23:13:24.762968+00:002020-04-24T23:13:24.762968+00:00https://mcpt.ca/problem/art6<p><strong>[user:hewmatt10] has been cornered!</strong></p> <p>With his Art Academy in ashes, his artworks missing, his friends all having left him, and his entire life in shambles, he has constructed a massive army with all of his forces in a <em>last stand</em>. The structure of his army is composed of $$N$$ line segments. Somewhere in the area, he has also hidden himself away in a secret bunker, at co-ordinates $$(x,\space y)$$.</p> <p>Knowing this information, [user:A_L_I_C_E_] has ordered h...Art Academy V: Ruin2020-04-24T23:13:24.762968+00:002020-04-24T23:13:24.762968+00:00https://mcpt.ca/problem/art5<p><em>Long live the Queen!</em></p> <p>After a heavy bombardment by the forces of Queen Alice, the Art Academy has started to collapse. Since [user:hewmatt10], the faithful leader of the Art Academy, was so fanatical in his obsession for art, pieces have been hung everywhere; including on the ceiling. [user:hewmatt10] has already managed to remove all his pieces on the walls, so he turns his salvation efforts to the sky, and prepares to catch the pieces as they fall. Fortunately for him, he is ...Art Academy IV: Alice's Blazing Fury2020-04-24T23:13:24.762968+00:002020-04-24T23:13:24.762968+00:00https://mcpt.ca/problem/art4<blockquote><p>You notice a disturbance in the area. Something on this particular day is strangely, <em>off</em>?</p> <p>Is it because [user:hewmatt10] has been sabotaged?</p> <p>Is it because both [user:astrocat879] and [user:skyflaren] are nowhere to be found?</p> <p>Simply put, it's <strong>much</strong> more frightening than that.</p> </blockquote> <p>Today marks the end of an era. [user:A_L_I_C_E_] has finally had enough of scandals like [user:hewmatt10] being able to freely roam around ...Art Academy III: Sabotage2020-04-24T23:13:24.762968+00:002020-04-24T23:13:24.762968+00:00https://mcpt.ca/problem/art3<p>After [user:hewmatt10]'s one and only friend, [user:astrocat879], left his Art Academy, [user:hewmatt10] had been running all across the city in hopes of finding someone that he can <del>kidnap</del> love. Searching far and wide, he eventually stumbles upon the <strong>love of his life</strong>: <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ" rel="nofollow"><strong><span style="color:purple">[REDACTED]</span></strong></a> . Wanting to see whether or not [user:hewmatt10] is worthy, <a hr...Art Academy II: The Grand Escape2020-04-24T23:13:24.762968+00:002020-04-24T23:13:24.762968+00:00https://mcpt.ca/problem/art2<p>After being trapped and tormented inside of [user:hewmatt10]'s <del>basement</del> "Art Academy", [user:astrocat879] decided that it was finally time for him to plan an escape. Fortunately, [user:hewmatt10] had never actually considered the possibility of him wanting to escape, so the actual escape would be a piece of cake.</p> <p>Along the Academy, there are a total of $$N$$ paintings spread across the area, each with a value of $$v_i$$. Since [user:astrocat879] is short on money, he plans t...Art Academy 0: Prologue2020-04-24T23:13:24.762968+00:002020-04-24T23:13:24.762968+00:00https://mcpt.ca/problem/art0<p>January 4th, 2028, marks the 25th time that [user:hewmatt10] has gotten rejected from art school.</p> <p>January 4th, 2028, also marks the day where he has started to go insane.</p> <blockquote><p>"I've had enough of this cruel, disgusting world," murmurs [user:hewmatt10].</p> <p>"I will one day have kidnapped each and every citizen of this world, and will have forced them all to suffer in the dark caverns of my cold and lonely basement."</p> <p>"Once they're all trapped there, screaming for ...Alawn's Problem2020-04-24T21:23:51.799300+00:002020-04-24T21:23:51.799300+00:00https://mcpt.ca/problem/testingc1p3<p>Alawn has a length $$N$$ array of pairs $$(a_i, b_i)$$. Initially, $$a_i = b_i$$ for all $$i$$.</p> <p>Alawn loves arrays that satisfy the following property:</p> <ul> <li>The $$a$$ values can be sorted by only swapping elements $$i$$ and $$j$$ where $$b_i \times b_j \le V$$.</li> </ul> <p>A <em>modification</em> to the array consists of decreasing element $$i$$'s $$b_i$$ value by $$1$$. Can you determine the minimum number of modifications required to turn the array of pairs into one that Al...A Graph Theory Problem2020-04-24T21:23:51.799300+00:002020-04-24T21:23:51.799300+00:00https://mcpt.ca/problem/testingc1p2<p>You are given a complete graph consisting of $$N$$ nodes, each with a value of $$v_i$$. The weight of the edge between nodes $$a$$ and nodes $$b$$ is $$v_a \oplus v_b$$, where $$\oplus$$ denotes the XOR operator. You wish to build the Minimum Spanning Tree (MST) of this graph.</p> <p>Can you output the position of the highest one bit of the heaviest edge in the MST?</p> <h4>Input Specification</h4> <p>The first line will contain $$T$$ $$(1 \le T \le 10)$$, the number of test cases. $$T$$ test...Addition Without Carry2020-04-24T21:23:51.799300+00:002020-04-24T21:23:51.799300+00:00https://mcpt.ca/problem/testingc1p1<p>Usually, when addition is performed, each carry is added onto the next digit in the number. For example, $$18 + 17 = 35$$, as the carry from $$8 + 7$$ is added onto $$1 + 1$$. If we perform addition <em>without</em> carry, the answer would have been $$25$$, as the carry from $$7+8$$ is discarded.</p> <p>Given two large numbers, can you perform addition <em>without</em> carry?</p> <h4>Input Specification</h4> <p>The first line will contain $$T$$ $$(1 \le T \le 10)$$, the number of test cases. ...Parrots and Cookies2020-04-13T22:33:20+00:002020-04-13T22:33:20+00:00https://mcpt.ca/problem/parrots<p>As a joke, [user:teacycart] the parrot decided to place $$N$$ cookies in a straight line in front of [user:dulldesk] the parrot. [user:dulldesk] likes cookies, so she wants to get as many of these cookies as possible. However, [user:teacycart] decided that this was too easy. So, each cookie in the line of cookies was given a value $$x (0 \leq x \leq 30)$$, meaning that if [user:dulldesk] takes the cookie they cannot take any of the next $$x$$ cookies. What is the maximum number of cookies [u...Warehousing2020-04-13T22:33:16+00:002020-04-13T22:33:16+00:00https://mcpt.ca/problem/warehousing<p>Larry got a new job at a warehouse! His job is to package items into boxes, and move them into storage. Unlike most other warehouses, however, this warehouse is forward-thinking and promotes diversity. Because of this, Larry is tasked with maximizing diversity in the boxes he packages.</p> <p>There are $$N$$ items on a conveyor belt in front of Larry of which he must package. Larry must take the items off the conveyor belt in the order they are on the conveyor belt, or else he will mess up th...