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



Similar documents
Hooray for the Hundreds Chart!!

Networks and Paths. The study of networks in mathematics began in the middle 1700 s with a famous puzzle called the Seven Bridges of Konigsburg.

Lesson Plans for (9 th Grade Main Lesson) Possibility & Probability (including Permutations and Combinations)

Unit 7 The Number System: Multiplying and Dividing Integers

Colored Hats and Logic Puzzles

MATHEMATICS. Y5 Multiplication and Division 5330 Square numbers, prime numbers, factors and multiples. Equipment. MathSphere

WORDS THEIR WAY. Thursday- FREE CHOICE: See the attached page with Free Choice options and assist your child in completing this activity.

Ready, Set, Go! Math Games for Serious Minds

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

TEACHER S GUIDE TO RUSH HOUR

Cubes and Cube Roots

Working with whole numbers

Accounting Games and Hands-on Activities. By Linda Welsh, Business Educator Whitehall High School

EXTRA ACTIVITy pages

AI: A Modern Approach, Chpts. 3-4 Russell and Norvig

PUSD High Frequency Word List

1. Define: (a) Variable, (b) Constant, (c) Type, (d) Enumerated Type, (e) Identifier.

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

TCM040 MSOM NEW:TCM040 MSOM 01/07/ :13 Page 1. A book of games to play with children

RACE TO CLEAR THE MAT

Count the Dots Binary Numbers

Maths Targets for pupils in Year 2

Pigeonhole Principle Solutions

Making Inferences Picture #1

BASIC RULES OF CHESS

Integers are positive and negative whole numbers, that is they are; {... 3, 2, 1,0,1,2,3...}. The dots mean they continue in that pattern.

Playing with Numbers

Penny Stacking. A contest to see who can stack the pennies the highest

4/1/2017. PS. Sequences and Series FROM 9.2 AND 9.3 IN THE BOOK AS WELL AS FROM OTHER SOURCES. TODAY IS NATIONAL MANATEE APPRECIATION DAY

Project 2: Bejeweled

Fun Basketball Drills Collection for Kids

THE WASHING MACHINE. Written by. Lorena Padilla

PIZZA! PIZZA! TEACHER S GUIDE and ANSWER KEY

Creating Maze Games. Game Maker Tutorial. The Game Idea. A Simple Start. Written by Mark Overmars

Third Grade Math Games

An Introduction to The A* Algorithm

Lesson 4: Efficiently Adding Integers and Other Rational Numbers

Grade 8 Performance Assessment Spring 2001

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Unit 6 Number and Operations in Base Ten: Decimals

Lab 11. Simulations. The Concept

Inclined Plane: Distance vs. Force

Text Analytics Illustrated with a Simple Data Set

Factorizations: Searching for Factor Strings

The Three Little Pigs

STEAM STUDENT SET: INVENTION LOG

Patterns in Pascal s Triangle

CS104: Data Structures and Object-Oriented Design (Fall 2013) October 24, 2013: Priority Queues Scribes: CS 104 Teaching Team

Date R. Mirshahi. Forces are all around us. Without forces, nothing can move and no work can be done.

The Fruit of the Spirit is Love

1 ENGAGE. 2 TEACH and TALK GO. Round to the Nearest Ten or Hundred

An Australian Microsoft Partners in Learning (PiL) Project


Horse Race or Steeplechase

PARALLELIZED SUDOKU SOLVING ALGORITHM USING OpenMP

Dynamic Programming. Lecture Overview Introduction

Teacher s Manual Carnivore/Herbivore Week

Session 6 Number Theory

PERMUTATIONS AND COMBINATIONS HOW TO AVOID THEM AT ALL COSTS AND STILL ACTUALLY UNDERSTAND AND DO COUNTING PROBLEMS WITH EASE!

ADDITION LESSON Excerpts

Fusion's runtime does its best to match the animation with the movement of the character. It does this job at three different levels :

Percentages. You will need a calculator 20% =

CONTENTS. Please note:

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

Games and Team Building Activities

Battleship. Big bands

Enumerating possible Sudoku grids

them scarf it down is gross. They eat more than we do and were rich.

Sunflowers. Name. Level and grade. PrimaryTools.co.uk

Practice Ideas Rookie / Junior Mosquito

Intro to the Art of Computer Science

2013 SCHOLARSHIP EXAMINATION PRACTICAL SECTION

Problem Set 7 Solutions

Self-Acceptance. A Frog Thing by E. Drachman (2005) California: Kidwick Books LLC. ISBN Grade Level: Third grade

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?

Kings of War (2015) - Official Errata

Analysis of Micromouse Maze Solving Algorithms

Mathematical Induction

Tasks to Move Students On

SALE TODAY All toys half price

REPORTED SPEECH. Reported speech is used to retell or report what other person has actually said. It is a very usual function in everyday language.

The Skeleton Key by Kelly Hashway

The Ten Commandments. Lesson At-A-Glance. Gather (10 minutes) Arrival Activity Kids create a graffiti wall with family rules.

Objective. Materials. TI-73 Calculator

3 Some Integer Functions

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 10

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

Math and FUNDRAISING. Ex. 73, p

Year 2 Summer Term Oral and Mental Starter Activity Bank

17 Laws of Soccer. LAW 5 The Referee The referee enforces the 17 laws.

Intermediate PowerPoint

Parable of the Faithful Servant Lesson 3 February 14 & 15

ACM International Collegiate Programming Contest 2005

OA4-13 Rounding on a Number Line Pages 80 81

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

Abraham s Call. Genesis 12:1 Leave your country and go to the land I will show you.

Planning Guide. Grade 6 Factors and Multiples. Number Specific Outcome 3

10 th POLISH SUDOKU CHAMPIONSHIP INSTRUCTION BOOKLET. February 22, 2015 IMPORTANT INFORMATION:

Transcription:

Task overview Task PATULJCI NPUZZLE TROJKE TENKICI BICIKLI LISTA Memory limit (heap) Memory limit (stack) Time limit (per test) Number of tests Points per test Total points standard (keyboard) standard (screen) 32 MB 32 MB 32 MB 32 MB 32 MB 32 MB MB MB MB MB MB MB 1 sec 1 sec 1 sec 1 sec 1 sec 1 sec 10 10 10 14 10 9 2 2 3 7 10 20 20 30 70 70 90 300 Note: The time limit is based on a computer running two AMD Athlon MP 2600+ processors and Linux operating system. C and C++ programs will be compiled with the following options: O2 lm static Pascal programs will be compiled with the following options: O1 XS

1. PATULJCI Every day, while the dwarves are busy in the mines, Snow White prepares dinner for them; seven chairs, seven plates, seven forks and seven knives for seven hungry dwarves. One day nine dwarves came from the mines instead of seven (nobody knows how or why), each of them claiming to be one of Snow White's seven dwarves. Luckily, each dwarf wears a hat with a positive integer less than 100 written on it. Snow White, a famous mathematician, realised long ago that the sum of numbers on the hats of her seven dwarves was exactly 100. Write a program which determines which dwarves are legit, i.e. pick seven of nine numbers that add to 100. There are 9 lines of. Each contains an integer between 1 and 99 (inclusive). All of the numbers will be distinct. Note: The test data will be such that the solution is unique. Your program must produce exactly seven lines of the numbers on the hats of Snow White's seven dwarves. the numbers in any order. 7 10 13 1 19 20 23 2 7 10 13 19 20 23 6 1 37 30 2 22 36 6 1 30 2 22

2. NPUZZLE N-puzzle is a puzzle that goes by many names and has many variants. In this problem we will use the 1-puzzle. It consists of a 4-by-4 grid of sliding squares where one square is missing. The squares are labeled with uppercase letters 'A' through 'O', with the desired layout as follows: A B C D E F G H I J K L M N O. It can be useful (for example, when solving the puzzle using a computer) to define the "scatter" of a puzzle as the sum of distances between each square's current position and its position in the desired layout. The distance between two squares is their Manhattan distance (the absolute value of the sum of differences between the two rows and the two columns). Write a program that calculates the scatter of the given puzzle. Four lines of contain four characters each, representing the state of the puzzle. the scatter of the puzzle on a single line. ABCD EFGH IJKL M.NO 2.BCD EAGH IJFL MNOK 6

3. TROJKE Mirko and Slavko are playing a new game, "Trojke" (Triplets). First they use a chalk to draw an N-by-N square grid on the road. Then they write letters into some of the squares. No letter is written more than once in the grid. The game consists of trying to find three letters on a line as fast as possible. Three letters are considered to be on the same line if there is a line going through the centre of each of the three squares. After a while it gets harder to find new triplets. Mirko and Slavko need a program that counts all the triplets, so that they know if the game is over or they need to search further. The first line contains an integer N (3 N 100), the dimension of the grid. Each of the N following lines contains N characters describing the grid uppercase letters and the character '.', which marks an empty square. the number of triplets on a single line. 4...D..C..B.. A... 4..T.. A....FE.R...X S... 3 10...AB.....C...D...E...F....G..H... I...J K...L...M..N....O...P...Q...R.....ST... 0

4. TENKICI Mirko found a collection of N toy tanks dating back to the Second World War on his grandfather's attic. He promptly called his friend Slavko to play with him. They made a battlefield a wooden board consisting of squares in N rows and N columns. Each tank can be moved to one of the four neighbouring squares in a single move. A tank can shoot at any square in the same row and column. The tank is said to be guarding the row and column it is in. Additionally, no two tanks can be in the same square at any time. After many hours of play and two previous attempts, Mirko's mom yelled at them to come down for lunch again, and they decided to rearrange the tanks so that each tank guards a different row and column (meaning also that each row and column contains only one tank). However, they want to do this using the minimum number of moves. Write a program that finds the minimum number of moves required to rearrange the tanks so that each row and each column contains a single tank, and one such shortest sequence of moves. The first line of contains the integer N ( N 00). Each of the following N lines contains two integers R and C (1 R, S N), the row and column of a single tank at the moment of mom's call. No two tanks are on the same square. Rows and columns are marked 1 through N, top-down and left-to-right. the minimum number of moves (call this number K) on the first line. Each of the next K lines should contain the tank being moved and the direction it is moved in, separated by a single space. Tanks are numbered 1 through N, in the order in which they are given in the. The direction can be one of four uppercase letters: 'L' for left, 'R' for right, 'U' for up and 'D' for down. Note: The sequence need not be unique. Scoring If both the number K and the sequence of moves are correct, your program will score full points on the test case. If your program s the correct number K and does not the sequence of moves, or the sequence of moves is incorrect, you will get 60% of the points for that test case.

4. TENKICI 1 1 1 2 1 4 1 10 1 D 2 D 3 D 4 D 1 D 2 D 3 D 1 D 2 D 1 D 2 3 3 2 3 3 4 3 1 R 1 R 2 U 2 U 4 D 4 D L L 6 1 1 1 2 2 1 6 6 6 6 2 R 2 D 3 D 3 R 4 U 4 L L U

. BICIKLI A bicycle race is being organized in a land far, far away. There are N town in the land, numbered 1 through N. There are also M one-way roads between the towns. The race will start in town 1 and end in town 2. How many different ways can the route be set? Two routes are considered different if they do not use the exact same roads. The first line of contains two integers N and M (1 N 10 000, 1 M 100 000), the number of towns and roads. Each of the next M lines contains two different integers A and B, representing a road between towns A and B. Towns may be connected by more than one road. the number of distinct routes that can be set on a single line. If that number has more than nine digits, only the last nine digits of the number. If there are infinitely many routes, "inf". 6 7 1 4 3 2 4 2 6 6 3 6 1 4 3 2 4 2 6 6 4 3 inf 31 60 4 4 6 6 6 7 6 7 2 29 2 29 29 30 29 30 30 31 30 31 31 2 31 2 07374124

6. LISTA Mirko received a birthday present from his aunt in the US a brand-new doubly-linked list (an example of which is shown in the figure below). The list contains N nodes numbered 1 through N. Two types of moves can be done on the list: A) Move node X in front of node Y. B) Move node X after node Y. An example of a list with 6 nodes. The list after the move "A 1 4". The list after another move, "B 3 ". Mirko played with his new toy for hours, writing down each move on a piece of paper so that he can reconstruct the list's initial state (nodes 1 through N in order from left to right). When he decided to reconstruct the list, Mirko was astonished to find that there is no easy way to invert the moves and restore the list's initial state. Mirko cannot know where node X was prior to each move, only where it ended up. Seeing how Mirko is still recovering from the shock, write a program that finds a minimal sequence of moves that restored the list's initial state from Mirko's logs. The first line of contains two integers N and K (2 N 00 000, 0 M 100 000), the number of nodes and the number of moves made by Mirko. Each of the next M rows contains a description of a single move made by Mirko the type of move ('A' or 'B') and two integers X and Y. the minimum number of moves (call this number K) on the first line. Each of the next K lines should contain a description of a single move in the same format as in the. Note: The sequence need not be unique.

6. LISTA Scoring If both the number K and the sequence of moves are correct, your program will score full points on the test case. If your program s the correct number K and does not the sequence of moves, or the sequence of moves is incorrect, you will get 60% of the points for that test case. 2 1 A 2 1 1 A 1 2 4 3 B 1 2 A 4 3 B 1 4 2 A 1 2 B 4 3 6 A 1 4 B 2 B 4 2 B 6 3 A 3 3 A 4 B 6 A 2 3