Recently added DMOJ problemshttps://dmoj.ca/The latest problems added on the DMOJ: Modern Online Judge websiteenSat, 22 Jul 2017 21:17:02 +0000IOI '02 P4 - Batch Schedulinghttps://dmoj.ca/problem/ioi02p4<div><p>There is a sequence of \(N\) jobs to be processed on one machine. The jobs are numbered from \(1\) to \(N\), so that the sequence is \(1, 2, \ldots, N\). The sequence of jobs must be partitioned into one or more batches, where each batch consists of consecutive jobs in the sequence. The processing starts at time \(0\). The batches are handled one by one starting from the first batch as follows. If batch \(b\) contains jobs with smaller numbers than batch \(c\), then batch \(b\) is handle...Sat, 22 Jul 2017 21:17:02 +0000https://dmoj.ca/problem/ioi02p4IOI '09 P4 - Raisinshttps://dmoj.ca/problem/ioi09p4<div><p>Plovdiv's famous master chocolatier Bonny needs to cut a slab of chocolate with raisins. The chocolate is a rectangular block of identical square pieces. The pieces are aligned with the edges of the chocolate, and they are arranged in \(N\) rows and \(M\) columns, for a total of \(N \times M\) pieces. Each piece has one or more raisins on it, and no raisins lie between or across pieces.</p>
<!---
<div style="text-align:center">
<img src="//dmoj.ml/data/ioi/09/ioi09p4/raisins1.png" style=...Wed, 19 Jul 2017 16:49:17 +0000https://dmoj.ca/problem/ioi09p4ECOO '13 R2 P4 - Breaking Rockshttps://dmoj.ca/problem/ecoo13r2p4<div><p>Farmer Jane needs to be able to measure out corn to feed her cows, but all she has to help her is a
primitive balance scale and a \(6\) kilogram rock. With this rock she could use the balance scale to measure
out \(6\) kg of corn, but she often needs to measure out smaller quantities. She figures out that if she
breaks the rock into three pieces, where two of them are \(1\) kg and the third is \(4\) kg, then she can
measure out all integer quantities of corn from \(1\) to \(6\), as shown...Tue, 04 Jul 2017 18:20:00 +0000https://dmoj.ca/problem/ecoo13r2p4IOI '12 P2 - Parachute Ringshttps://dmoj.ca/problem/ioi12p2<div><p>An early and quite sophisticated version of what we now call a parachute is described in Leonardo's <em>Codex Atlanticus</em> (ca. 1485). Leonardo's parachute consisted of a sealed linen cloth held open by a pyramid-shaped wooden structure.</p>
<h5>Linked rings</h5>
<p>Skydiver Adrian Nicholas tested Leonardo's design more than 500 years later. For this, a modern lightweight structure tied Leonardo's parachute to the human body. We want to use linked rings, which also provide hooks for t...Tue, 04 Jul 2017 15:42:52 +0000https://dmoj.ca/problem/ioi12p2IOI '12 P3 - Crayfish Scrivenerhttps://dmoj.ca/problem/ioi12p3<div><p>Some people say that Leonardo was a great admirer of Johannes Gutenberg, the German blacksmith who invented movable-type printing, and that he paid homage by designing a machine called the crayfish scrivener — <em>il gambero scrivano</em> — a very simple typing device. It is somehow similar to a simple modern typewriter and accepts only two commands: one to type the next character and one to undo the most recent commands. The notable feature of the crayfish scrivener is that the undo com...Mon, 03 Jul 2017 21:36:26 +0000https://dmoj.ca/problem/ioi12p3ECOO '15 R3 P4 - Under the Rughttps://dmoj.ca/problem/ecoo15r3p4<div><p>You’re a member of the custodial staff at a large convention centre. You came in for your shift this morning to find that the contractors painting the ceiling overnight had an accident and now there’s a huge paint stain on the floor. It’s already dried. The boss wants you to do something about it.</p>
<p>Fortunately, the convention centre has a huge stock of square carpet tiles in a range of sizes that you can put down on the floor to cover the stain. These carpet tiles are so thin that ...Mon, 26 Jun 2017 01:23:00 +0000https://dmoj.ca/problem/ecoo15r3p4ECOO '15 R3 P3 - Roadie Crosshttps://dmoj.ca/problem/ecoo15r3p3<div><p>Somewhere in a parallel world, one of Taylor Swift’s roadies is trying to get across a busy road carrying a huge load of equipment. She’s so loaded down that she can’t go left, right or backwards. She can only step forward or wait where she is. Can you help her get across the road?</p>
<p>Roads are strange in this parallel world. Each road consists of a number of lanes of traffic, but the first lane moves left, the next moves right, and then the lanes continue to alternate directions unt...Mon, 26 Jun 2017 01:22:00 +0000https://dmoj.ca/problem/ecoo15r3p3Kickstart '17 RC PC - Magical Thinkinghttps://dmoj.ca/problem/kickstart17r3p3<div><p>You and \(N\) of your friends just took the B.A.T. (Binary Answer Test) to try to get into wizard school. The B.A.T. has \(Q\) true-false questions, and each one is worth \(1\) point. You have no wizard powers, so you just picked arbitrary answers and hoped for the best.</p>
<p>The results of the test have already been sent out by quail mail, but the quail with your results has not arrived yet. However, each of your friends has told you their list of answers and their total score. You al...Mon, 26 Jun 2017 01:00:00 +0000https://dmoj.ca/problem/kickstart17r3p3Kickstart '17 RC PB - X Squaredhttps://dmoj.ca/problem/kickstart17r3p2<div><p>The hot new toy for this year is called "X Squared". It consists of a square \(N\) by \(N\) grid of tiles, where \(N\) is odd. Exactly \(2 \times N - 1\) of the tiles are labeled with an <code>X</code>, and the rest are blank (which we will represent with the <code>.</code> character). In each move of the game, the player can either choose and exchange two rows of tiles, or choose and exchange two columns of tiles. The goal of the game is to get all of the <code>X</code> tiles to be on t...Sun, 25 Jun 2017 23:50:00 +0000https://dmoj.ca/problem/kickstart17r3p2Kickstart '17 RC PA - Ambiguous Cipherhttps://dmoj.ca/problem/kickstart17r3p1<div><p>Susie and Calvin are classmates. Calvin would like to be able to pass notes to Susie in class without their teacher or other classmates knowing what they are talking about, just in case the notes fall into the wrong hands. Calvin has devised the a system to encrypt his messages.</p>
<p>Calvin only passes one word to Susie each time, and that word consists of only uppercase letters, because Calvin is so excited to talk to Susie. Each word is encrypted as follows:</p>
<ul>
<li>Calvin assig...Sun, 25 Jun 2017 23:00:00 +0000https://dmoj.ca/problem/kickstart17r3p1COCI '06 Contest 4 #5 Jogurthttps://dmoj.ca/problem/coci06c4p5<div><p>A complete binary tree is made of nodes arranged in a hierarchic structure. One of the nodes is the root node, said to be at level \(0\). The root node has two child nodes, which are at level \(1\). Each of those has two children at level \(2\) etc.</p>
<p>In general, a complete binary tree with \(N\) levels has \(2^{N-1}\) nodes, each of which has two child nodes, except those at level \(L-1\).</p>
<p>A number can be written into each node. Write the numbers \(1\) to \(2^{N-1}\) into a ...Sat, 24 Jun 2017 16:20:21 +0000https://dmoj.ca/problem/coci06c4p5ECOO '15 R3 P2 - Tiling Troublehttps://dmoj.ca/problem/ecoo15r3p2<div><p>A grid is subdivided into right-angled triangles with an arbitrary base (horizontal) and height (vertical). In the images below, the base of each triangle is \(5\) and the height is \(3\). Each triangular tile is made of a special color-changing material. By "reversing the polarity" of a tile you can trigger a color change.</p>
<p>Given a starting point (the \(X\) and \(Y\) coordinate of the right angle of a tile) and measurements in the horizontal and vertical directions, larger shapes ...Sun, 18 Jun 2017 04:03:03 +0000https://dmoj.ca/problem/ecoo15r3p2ECOO '15 R3 P1 - Just the Factoradics, Ma'amhttps://dmoj.ca/problem/ecoo15r3p1<div><p>The factoradic number system is a number system that uses factorials as the place value for each digit. In case you don't know, the factorial value of an integer \(n\) is written \(n!\) and it evaluates to what you get when you multiply together all the integers from \(1\) to \(n\), like this:</p>
<p>\[ 5! = 5 \times 4 \times 3 \times 2 \times 1 = 12 0\]</p>
<p>In the factoradic number system, the rightmost "digit" has a base value of \(0!\), the second digit has a base value of \(1!\), ...Sun, 18 Jun 2017 00:16:04 +0000https://dmoj.ca/problem/ecoo15r3p1ECOO '16 R3 P4 - Cuthbert's Calculatorhttps://dmoj.ca/problem/ecoo16r3p4<div><p>Your friend Cuthbert has a broken calculator. When it was working properly, it had buttons for all \(10\) decimal digits (\(0\) through \(9\)), plus three binary operators \((+, -, \times)\), two unary operators \((\pm, x^{2})\), two memory functions (<code>store</code> and <code>recall</code>) and a <code>clear</code> button. Binary operators require two operands to produce an answer (e.g. \(12 + 4 = 16\)). Unary operators require only one operand: the \(\pm\) button changes the sign of...Sat, 17 Jun 2017 22:54:09 +0000https://dmoj.ca/problem/ecoo16r3p4Mocking SpongeBobhttps://dmoj.ca/problem/mockingspongebob<div><div style="width: 190px; height: 190px; float: right; clear: left; padding: 10px"><img src="https://camo.dmuser.ml/6d1a28c28d5bca18549e4ba5f65fa2075d471d82/687474703a2f2f69332e6b796d2d63646e2e636f6d2f656e74726965732f69636f6e732f6f726967696e616c2f3030302f3032322f3934302f73706f6e6765626f6269636f6e2e6a7067" alt="Mocking Spongebob"></div><p>You are a professional memer. Your memes have garnered thousands of upvotes on Reddit and have been reposted by hundreds.</p>
<p>Late into the night, on Ma...Sat, 10 Jun 2017 15:37:32 +0000https://dmoj.ca/problem/mockingspongebobAPIO '12 P3 - Kunaihttps://dmoj.ca/problem/apio12p3<div><p>Kunai is an acuate weapon used by ninjas whose shape is similar to a knife. Ninjas were attacking their enemies by throwing kunais against them.</p>
<p>There are \(N\) ninjas in a grid of squares with \(W\) columns and \(H\) rows. Every ninja is in the center of a square, and no two ninjas share the same square. Each ninja has a kunai, and looks toward one of the four directions; up, down, left, or right. At time \(0\), every ninja threw his/her kunai to the direction he/she is looking t...Sat, 10 Jun 2017 15:01:16 +0000https://dmoj.ca/problem/apio12p3APIO '12 P2 - Guardhttps://dmoj.ca/problem/apio12p2<div><p>The Kingdom of APIO is attacked by ninjas. Ninjas are very strong because, when they attack, they are hiding
in the shadows and other people cannot see them. The Kingdom was captured except for the APIO castle, where
the king lives. In front of the APIO castle, there is a line of N bushes. The bushes are numbered from \(1\) to \(N\),
and \(K\) ninjas are hiding in exactly \(K\) bushes. There are \(M\) guards in the APIO castle. The guard \(i\) is watching a
sequence of bushes from the bu...Sat, 10 Jun 2017 14:59:31 +0000https://dmoj.ca/problem/apio12p2APIO '12 P1 - Dispatchinghttps://dmoj.ca/problem/apio12p1<div><p>In a sect of ninja, ninjas are dispatched to a client, and they are rewarded according to their work.</p>
<p>In this sect, there is one ninja called the Master. Every ninja except the Master has one and only one boss.</p>
<p>In order to preserve the confidentiality and to encourage leadership, any instructions concerning their work are always sent by a boss to his/her subordinates. It is forbidden to send instructions by other methods. You are gathering a number of ninjas and dispatch th...Sat, 10 Jun 2017 14:57:34 +0000https://dmoj.ca/problem/apio12p1RTE '16 S3 - School Traversalhttps://dmoj.ca/problem/rte16s3<div><p>Ellen is a student at RHHS who is trying to navigate her way through the school to get to her classes. She knows that most halls are going to be blocked off by large groups of aimless students, so she has devised a map of the school which only includes hallways she knows will be open. In particular, the school can be represented as a collection of \(N\) classrooms numbered \(0\) to \(N - 1\) with \(N - 1\) hallways between them. It is guaranteed that these hallways will never form a loop...Sun, 04 Jun 2017 05:40:00 +0000https://dmoj.ca/problem/rte16s3RTE '16 S2 - Fire Evacuation Planhttps://dmoj.ca/problem/rte16s2<div><p>At RHHS, the school is on fire every other day, because safety is our number one priority. After administration has decided enough was enough, they decided to place detailed evacuation plans in each and every classroom to ensure everyone's safety during fire evacuations.</p>
<p>An evacuation plan consists of a list of movements in cardinal directions (North, South, East, West), which detail the exact movements a student must make in order to make it to safety.</p>
<p>One such evacuation ...Sun, 04 Jun 2017 05:19:20 +0000https://dmoj.ca/problem/rte16s2RTE '16 S1 - Battery Pyramidshttps://dmoj.ca/problem/rte16s1<div><p>If you want to find the most innovative students at RHHS, there’s only one place to look: TEJ4M1. Here, the students are always finding new ways to challenge reality and solve unknown problems. On an average day in TEJ4M1, the students had an extra-special idea. They decided to stack all of the AA batteries in the classroom into triangles of different base sizes, as shown below.</p>
<p>However, they encountered a little problem. Out of the \(N\) batteries available in the classroom, the ...Sun, 04 Jun 2017 05:00:00 +0000https://dmoj.ca/problem/rte16s1RTE '16 J3 - Mule Warshttps://dmoj.ca/problem/rte16j3<div><p>While many claim that Richmond Hill High School is one of the most peaceful schools they’ve ever seen, their words aren’t necessarily true. Enter mule wars, a devastating battle that has been going on for the past decade, right below the school. The mules run around trying to find jelly beans, shooting each other with deadly STRANGOs, all while trying their best not to get covfefed, the ultimate humiliation.</p>
<p>All of this started when the mule king, Mr. Lookinhere, learned about an ...Sun, 04 Jun 2017 04:05:36 +0000https://dmoj.ca/problem/rte16j3RTE '16 J2 - Guidance Counsellinghttps://dmoj.ca/problem/rte16j2<div><p>At RHHS, the most you can do to ensure your timetable aligns with your course selections is to pray. Perhaps you’ll have only one course this semester, or maybe even three spares? Maybe you’ll get an alternate you didn’t even think about choosing, or maybe you’ll be forced to take vocal music?</p>
<p>As a result of these timetable catastrophes, a very long line has formed outside the guidance office, and they are unable to process them all. Each student in the line has a timetable change...Sun, 04 Jun 2017 04:00:00 +0000https://dmoj.ca/problem/rte16j2RTE '16 J1 - Board Gamehttps://dmoj.ca/problem/rte16j1<div><p><strong>GoldenHippo</strong> is playing Scrabble. However, instead of playing normally, he is simply taking tiles out of a bag with practically unlimited tiles, and using them to make a sentence. However <strong>GoldenHippo</strong> is particularly concerned with the letter <code>L</code>.</p>
<p>Given the sentence that <strong>GoldenHippo</strong> made, he wants you to determine the number of <code>L</code>s he took, as well as the maximum number of consecutive <code>L</code>s taken, wi...Sun, 04 Jun 2017 03:43:50 +0000https://dmoj.ca/problem/rte16j1ECOO '17 R3 P4 - Ice Cream Beachhttps://dmoj.ca/problem/ecoo17r3p4<div><p>Harnessing your entrepreneurial spirit, you have decided to found a start-up. Your start-up, the first of its kind, will sell ice cream at the local beach. Every day, the beach gets \(N\) visitors which sit at specific locations on the beach. The visitors would all love to buy ice cream, but they don't like walking around in the sun. A visitor's reluctance to buy ice cream is calculated by multiplying their distance from the nearest ice cream stand by their reluctance factor: a number un...Sun, 04 Jun 2017 01:37:45 +0000https://dmoj.ca/problem/ecoo17r3p4