TASK MOBITEL UTRKA STUDENTSKO BOB ŠUMA NORMA. standardni input (stdin) standardni output (stdout) score

Similar documents
Unit 7 The Number System: Multiplying and Dividing Integers

Croatian Open Competition in Informatics, contest 3 December 16, 2006

Lesson Lesson 2.2 ~ Adding Integers

Data Structures. Chapter 8

Motion Graphs. It is said that a picture is worth a thousand words. The same can be said for a graph.

The GMAT Guru. Prime Factorization: Theory and Practice

SALE TODAY All toys half price

Adding Integers Using a Number Line

Paper Reference. Ruler graduated in centimetres and millimetres, protractor, compasses, pen, HB pencil, eraser, calculator. Tracing paper may be used.

Module 49 Consumer and Producer Surplus

Paper 1. Calculator not allowed. Mathematics test. First name. Last name. School. Remember KEY STAGE 3 TIER 5 7

Problems translated from Croatian by: Ivan Pilat

Session 6 Number Theory

Pigeonhole Principle Solutions

An Introduction to Number Theory Prime Numbers and Their Applications.

Ready, Set, Go! Math Games for Serious Minds

If A is divided by B the result is 2/3. If B is divided by C the result is 4/7. What is the result if A is divided by C?

Grade 7/8 Math Circles Fall 2012 Factors and Primes

[elo'quia. S 1 / 6. Please mark the correct answer with a X. Example: I must my homework this evening. X. Duration: 45 minutes.

1 Math 1313 Final Review Final Review for Finite. 1. Find the equation of the line containing the points 1, 2)

chapter >> Consumer and Producer Surplus Section 1: Consumer Surplus and the Demand Curve

Paper 1. Calculator not allowed. Mathematics test. First name. Last name. School. Remember KEY STAGE 3 TIER 4 6

Encoding Text with a Small Alphabet

Math Quizzes Winter 2009

Volume of Pyramids and Cones

NF5-12 Flexibility with Equivalent Fractions and Pages

The Fruit of the Spirit is Love

Using games to support. Win-Win Math Games. by Marilyn Burns

Python Loops and String Manipulation

Linear functions Increasing Linear Functions. Decreasing Linear Functions

Canadian Math Kangaroo Contest

UM Online Practice Programming Contest September 20, 2011

Session 7 Fractions and Decimals

2014 Chapter Competition Solutions

1. When the least common multiple of 8 and 20 is multiplied by the greatest common factor of 8 and 20, what is the result?

Lesson 4: Efficiently Adding Integers and Other Rational Numbers

Playing with Numbers

Club Accounts Question 6.

An excerpt from The Every Computer Performance Book. The Four Numbers of Capacity Planning 1

SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89. by Joseph Collison

Has difficulty with counting reliably in tens from a multiple of ten

Phonics. High Frequency Words P.008. Objective The student will read high frequency words.

CALCULATIONS. Understand the operation of addition and the related vocabulary, and recognise that addition can be done in any order

Introduction to SQL for Data Scientists

ONLINE SAFETY TEACHER S GUIDE:

4. How many integers between 2004 and 4002 are perfect squares?

Math Games For Skills and Concepts

Methods Used for Counting

Sample Problems. Practice Problems

HOW TO SUCCEED WITH NEWSPAPER ADVERTISING

Economics. Worksheet Circular Flow Simulation

The theory of the six stages of learning with integers (Published in Mathematics in Schools, Volume 29, Number 2, March 2000) Stage 1

Year 9 mathematics test

A Concrete Introduction. to the Abstract Concepts. of Integers and Algebra using Algebra Tiles

Vacation Church School. Woman at the Well

EXTRA ACTIVITy pages

CAPS. Mathematics. Grade 2. Practice Book. Practice Book. Practice. Book. Book. Book. Book. Book. Book. Book. Book. Book. Book. Book. Book.

What really drives customer satisfaction during the insurance claims process?

Chapter 1: Learning the basics of a Google AdWords Campaign

Task: ASC Ascending Paths

Unit Conversions. Ben Logan Feb 10, 2005

ALGEBRA. sequence, term, nth term, consecutive, rule, relationship, generate, predict, continue increase, decrease finite, infinite

TeachingEnglish Lesson plans

Algebra: Real World Applications and Problems

The GED math test gives you a page of math formulas that

Kodu Curriculum: Single Session Intro

Year 9 mathematics test

Show all work for credit. Attach paper as needed to keep work neat & organized.

Year 9 mathematics: holiday revision. 2 How many nines are there in fifty-four?

Revision Notes Adult Numeracy Level 2

Class One: Degree Sequences

LESSON TITLE: Jesus Visits Mary and Martha THEME: Jesus wants us to spend time with \ Him. SCRIPTURE: Luke 10:38-42

These tests contain questions ranging from Level 3 to Level 4. They get progressively more difficult. Children should have five seconds to

Linear Programming Notes VII Sensitivity Analysis

The Taxman Game. Robert K. Moniot September 5, 2003

chapter >> Making Decisions Section 2: Making How Much Decisions: The Role of Marginal Analysis

Lecture 3. Linear Programming. 3B1B Optimization Michaelmas 2015 A. Zisserman. Extreme solutions. Simplex method. Interior point method

Roulette-Tools PATTERN RECOGNITION TRAINING

1 HARVEST once number of land tiles in the chain times 3 pesos opponent s chains SCORING animal card supply exhausted At the end of this round

The fundamental question in economics is 2. Consumer Preferences

Third Southern African Regional ACM Collegiate Programming Competition. Sponsored by IBM. Problem Set

Decimals and Percentages

Big Bend Community College. Beginning Algebra MPC 095. Lab Notebook

Multiplication. Year 1 multiply with concrete objects, arrays and pictorial representations

EMILY WANTS SIX STARS. EMMA DREW SEVEN FOOTBALLS. MATHEW BOUGHT EIGHT BOTTLES. ANDREW HAS NINE BANANAS.

Python Lists and Loops

chapter >> Consumer and Producer Surplus Section 3: Consumer Surplus, Producer Surplus, and the Gains from Trade

Evaluating Real Costs for Building Maintenance Management

SO-03 Sales Order Processing Administration

Inform Racing User Guide.

Telemarketing Selling Script for Mobile Websites

Lab 11. Simulations. The Concept

Hooray for the Hundreds Chart!!

Digital Single Line (DSL) Analog Single Line (SLT) Quick Reference Guide DSL05 April Printed in U.S.A. (2562)

EKOLA Junior High School Bilingual Programme Entrance Test (1h15) Sample Paper. Result:

Opposites are all around us. If you move forward two spaces in a board game

Cubes and Cube Roots

Basic Components of an LP:

2015 BANK OF AMERICA CHICAGO MARATHON TRAINING PLAN JUST DO IT.

Grade 7/8 Math Circles November 3/4, M.C. Escher and Tessellations

Transcription:

TASK MOBITEL UTRKA STUDENTSKO BOB ŠUMA NORMA standardni (stdin) standardni (stdout) time limit 1 second 1 second 1 second 1 second 2 seconds seconds memory limit 2 MB 6 MB 6 MB 6 MB 128 MB 6 MB score 50 80 100 120 10 160 total 650 Problem translated from Croatian by: Paula Gombar

Task MOBITEL 1 second, 2 MB, 50 points Grasshopper Marko was jumping happily all over the meadow. He wasn t being careful and his Nokia 10 fell into a puddle. His mobile phone is now acting funny! The contacts got wet and the keyboard works in a completely unpredictable manner! All the numerical keys broke down. When we press one of them, the mobile phone acts as if we pressed another key. Luckily, there are no two keys that are acting the same so Marko can still write all the letters. Grasshopper Marko was experimenting a bit and found out how each key acts. Now he wants to write a message to his girlfriend. Since he is just a grasshopper, you will do that for him. To all those who don t remember how mobile phones with keys work, here is a short description. 1 2 abc def 5 6 ghi jkl mno 7 8 9 pqrs tuv wxyz * 0 # Keyboard on a very old mobile phone. The image shows keys with letters that we can get by pressing that key (on a working mobile phone that didn t fall into a puddle). For example, if we want to get letter a we will press key 2 once, and if we want letter b we will press the key 2 twice. If we want to write two letters from the same key consecutively, we have to press the pound key ( # ) exactly once. For example, if we want to write the string klor we will press the keys in the following order: 55#555666777. The first line of contains 9 integers. The first integer marks the behaviour of key 1, the second the behaviour of key 2, the third the behaviour of key, and so on. Marko is not using keys * and 0 because he is a grasshopper. Key # can t get broken. The second line of contains a string consisting of only lowercase letters of the English alphabet. The length of the word won t exceed 100 characters. The first and only line of must contain the sequence of keys you need to press in order to write Marko s message. 2 5 6 7 8 9 1 klor 7 8 9 1 2 6 5 djevojka 9 8 7 6 5 2 1 skakavac #555666 68662227778#885 5585582228#888 Clarification of the first example: All of the keys are shifted one place to the right so the differs a little bit from the example in the task statement.

Task UTRKA 1 second, 6 MB, 80 points Numerous local and international recreational runners were eager to take part in this year s Zagreb Marathon! It is an already traditional race 2 125 meters long. A curious statistical info is that this year every single contestant managed to complete the race, except one. Since marathons are all about taking part, help the organizers figure out, based on the list of registered contestants and ranking list, the identity of the contestant that did not complete the race. The first line of contains the integer N (1 N 10 5 ), the number of contestants. Each of the following N lines contains the names of registered contestants. The additional N 1 lines contain the names of contestants in the order which they completed the race. The contestants names will consist of at least one and at most twenty lowercase letters of the English alphabet. The contestants names won t necessarily be unique. The first and only line of must contain the name of the contestant who didn t finish the race. In test cases worth 50% of total points, it will hold 1 N 1 000. leo kiki eden eden kiki 5 marina josipa nikola vinko filipa josipa filipa marina nikola mislav stanko mislav ana stanko ana mislav leo vinko mislav

Task STUDENTSKO 1 second, 6 MB, 100 points The annual student team competition in table tennis of students enrolled in University of Zagreb takes place next Saturday! Each team consists of K students. The excited students, N of them, are waiting in queue to register. Krešo works at the registration desk. He doesn t really feel like doing his job so he decided not to allow students to choose a team. He decided that the first team will consist of the first K students standing in queue, the second team the following K students, the third one the following K students and so on... (N will be divisible by K so nobody is left hanging.) Ante has estimated the skill of each player with an integer. He would like to have the K strongest players in the first team, the following K strongest in the second team and so on... Krešo has just taken a break and Ante decided to shift the students standing in queue so that he achieves his goal. The way he shifts them is that he tells a student to step out of the queue and go back in queue after another student or to go to the front of the queue. It takes him one minute to do this. It s possible that Krešo is going to return from his break any moment so Ante needs to achieve his goal as soon as possible. Help Ante determine the minimal number of minutes necessary for him to achieve his goal. The first line of contains the integers N and K (1 K N 5 000). The integer N is going to divisible by K. The second line contains N space separated integers v i (1 v i 10 9 ), i th number denotes the skill of the i th player standing in queue. All contestants are going to have distinct levels of skill. The first and only line of must contain the minimal required number of minutes. In test cases worth 0% of total points, it will hold N 20. 1 9 12 5 1 6 2 16 2 1 7 5 10 6 7 9 8 6 5 1 1 Clarification of the third example: Ante should move the students with skill levels 5, 6 and to the front of the queue. It takes him three minutes to do that.

Task BOB 1 second, 6 MB, 120 points Little Bob is a famous builder. He bought land and wants to build a house. Unfortunately, the problem is the land s terrain, it has a variable elevation. The land is shaped like a rectangle, N meters wide and M meters long. It can be divided into N M squares (see the image). Bob s house will be shaped like a rectangle that has sides parallel with the land s edges and its vertices coincide with the vertices of the squares. All the land covered by Bob s house must be of equal elevation to prevent it from collapsing. 2 2 1 2 1 2 1 2 1 The land divided into squares. Two possible locations of house are marked with red and blue. Calculate the number of ways Bob can build his house! The first line of contains integers N and M (1 N, M 1 000). Each of the following N lines contains M integers a ij (1 a ij 10 9 ), respectively the height of each square of land. Warning: Please use faster methods beacuse the amount of is very large. (For example, use scanf instead of cin in C++ or BufferedReader instead of Scanner in Java.) The first and only line of must contain the required number from the task statement. In test cases worth 20% of total points, it will hold N, M 50. In test cases worth 60% of total points, it will hold N, M 500. 5 2 2 1 2 1 2 1 2 1 27 6 Clarification of the first example: Some of the possible house locations are rectangles with opposite vertices in (0,0)- (1,1), (0,0)-(0,2) (height 2) i (2,0)-(2,2), (1,2)-(2,2) (height 1). The first number in the brackets represents the row number and the second one the column number (0-indexed).

Task ŠUMA 2 seconds, 128 MB, 10 points Mirko lives in a big enchanted forest where trees are very tall and grow really quickly. That forest can be represented as an N N matrix where each field contains one tree. Mirko is very fond of the trees in the enchanted forest. He spent years observing them and for each tree measured how many meters it grew in a year. The trees grow continuously. In other words, if the tree grows 5 meters in a year, it will grow 2.5 meters in half a year. Apart from trees, Mirko likes mushrooms from the enchanted forest. Sometimes, he eats suspicious colorful mushrooms and starts thinking about peculiar questions. Yesterday, this unfortunate thing happened and he wondered what would be the size of the largest connected group of trees that are all of equal height if the trees continue to grow at the same speed they re growing at that moment. Mirko quickly measured the current height of all trees in the forest and asked you to answer his question. Two trees are adjacent if their fields in the matrix share a common edge. Two trees are connected if there is a sequence of adjacent trees that leads from the first to the second. A group of trees is connected if every pair of trees in the group is connected. The first line of contains the integer N (1 N 700). After the first line, N lines follow, each of them containing N integers. The i th line contains integers h ij (1 h ij 10 6 ), the initial height of tree in the i th row and j th column, given in meters. After that, N more lines follow with N integers. The i th line contains integers v ij (1 v ij 10 6 ), the growth speed of the tree in the i th row and j th column, given in meters. Warning: Please use faster methods beacuse the amount of is very large. (For example, use scanf instead of cin in C++ or BufferedReader instead of Scanner in Java.) The first and only line of must contain the required number from the task. In test cases worth 0% of total points, it will hold 1 N 70. 1 2 2 2 5 2 1 2 1 1 2 1 1 2 2 1 2 5 2 5 7 Clarification of the second example: after 8 months (two thirds of a year), the trees located at (0, 0), (0, 1) and (1, 0) will be 1/ meters in height.

Task NORMA seconds, 6 MB, 160 points Mirko got an array of integers for his birthday from his grandmother Norma. As any other kid, he was hoping for some money, but got an array. Luckily, in his town there is a pawn shop that buys up arrays. The cost of an array of integers is min max L kunas, where min is the minimal integer in the array, max is the maximal and L is the array length. Mirko is going to sell a subsequence of consecutive numbers from his array. He calculated the average price of all such subsequences. In order to check his result, he wants you to do the same. He will be pleased with only the last 9 digits of the sum of all prices, so you don t need to bother with large and real numbers. The first line of contains an integer N (1 N 500 000). Each of the following N lines contains a member of Mirko s array. The members of the array will be integers from the interval [1, 10 8 ]. The first and only line of must contain an integer, the last 9 digits of the required sum from the task. You don t need to the leading zeroes of that 9-digit integer. In test cases worth 0% of total points, it will hold N < 5 000. 2 1 2 1 16 109 102 Clarification of the first example: The array consists of two integers, 1 and. The possible subsequences Mirko can sell are (1), () and (1,), their prices being 1, 9 and 6, respectively, which is 16 summed up. Clarification of the second example: The possible subsequences Mirko can sell are (2), (), (1), (), (2, ), (, 1), (1, ), (2,,1), (,1,) and (2,,1,). Their prices are, 16, 1, 16, 16, 8, 8, 12, 12 and 16, respectively, which is 109 summed up. 6 8 1 9 7