COCI 2008/2009 Contest #1, 18 th October 2008 TASK SKOCIMIS PTICE MRAVOJED JEZ SKAKAVAC KRTICA

Similar documents
TASK NOP CIJEVI ROBOTI RELJEF. standard output

TASK OKUPLJANJE USPON RAZINE ABECEDA STEP VODA. uspon.pas uspon.c uspon.cpp. razine.pas razine.c razine.cpp

COCI 2008/2009 Contest #5, 7 th February 2009 TASK LJESNJAK JABUKA JAGODA LUBENICA TRESNJA KRUSKA

CSE Day 2016 COMPUTE Exam. Time: You will have 50 minutes to answer as many of the problems as you want to.

Croatian Open Competition in Informatics, contest 5 February 23, 2008

COCI 2008/2009 Contest #3, 13 th December 2008 TASK PET KEMIJA CROSS MATRICA BST NAJKRACI

COCI 2017/2018. Round #1, October 14th, Tasks. Task Time limit Memory limit Score. Cezar 1 s 64 MB 50. Tetris 1 s 64 MB 80

The 2016 ACM-ICPC Asia China-Final Contest Problems

WPF PUZZLE GP 2019 ROUND 3 INSTRUCTION BOOKLET. Host Country: Serbia. Čedomir Milanović, Zoran Tanasić, Nikola Živanović NOMNONMON B NOMNONMON

WPF PUZZLE GP 2017 ROUND 5A COMPETITION BOOKLET. Host Country: Czech Republic C D. Author: Jan Novotný

Problems translated from Croatian by: Ivan Pilat

TASK JACK PROZORI ZAGRADE REZ PASTELE KOŠARE. zagrade.pas zagrade.c zagrade.cpp. time limit 1 second 1 second 1 second 1 second 5 seconds 2 second

COCI 2008/2009 Contest #4, 17 th January 2009 TASK MJEHURIC DATUM ROT SLIKAR TREZOR PERIODNI

ProCo 2017 Advanced Division Round 1

TASK FUNGHI ZMIJA TRAKTOR ZGODAN JABUKE DIVLJAK. standard input (stdio) standard output (stdout)

Episode 3 16 th 19 th March Made In India and Regions by Prasanna Seshadri

CSE548, AMS542: Analysis of Algorithms, Fall 2016 Date: Sep 25. Homework #1. ( Due: Oct 10 ) Figure 1: The laser game.

2016 Canadian Computing Olympiad Day 2, Problem 1 O Canada

The University of Melbourne BHPBilliton School Mathematics Competition, 2007 JUNIOR DIVISION, QUESTIONS & SOLUTIONS

Math Contest Preparation II

Do not duplicate or distribute without written permission from CMKC!

The 2017 British Informatics Olympiad

CROATIAN OPEN COMPETITION IN INFORMATICS. 7 th ROUND

Q i e v e 1 N,Q 5000

UW-Madison's 2009 ACM-ICPC Individual Placement Test October 9th, 1:00-6:00pm, CS1350

Canadian Math Kangaroo Contest

UN DOS TREZ Sudoku Competition. Puzzle Booklet for Preliminary Round. 19-Feb :45PM 75 minutes

FRI Summer School Final Contest. A. Flipping Game

UKMT UKMT UKMT. Junior Kangaroo Mathematical Challenge. Tuesday 12th June 2018

UKMT UKMT UKMT. Junior Kangaroo Mathematical Challenge. Tuesday 13th June 2017

Unhappy with the poor health of his cows, Farmer John enrolls them in an assortment of different physical fitness activities.

A Grid of Liars. Ryan Morrill University of Alberta

International Contest-Game MATH KANGAROO Canada, 2007

2015 ACM ICPC Southeast USA Regional Programming Contest. Division 1

Missing Sequence. You have 10 minutes to complete this test. Select the square that comes next in the sequence.

1 Stove. Task. Input. Output. Constraints

WPF PUZZLE GP 2018 ROUND 4 COMPETITION BOOKLET. Host Country: Czech Republic

WPF PUZZLE GP 2018 ROUND 2. COMPETITION BOOKLET Host Country: Switzerland. ScHWeIZ. ScHWeiz. schweiz. SchWEIZ. SchwEiz. SchWEiZ. schweiz.

ACM International Collegiate Programming Contest 2010

COCI 2008/2009 Contest #2, 15 th November 2008 TASK KORNISLAV RESETO PERKET SVADA SETNJA CAVLI

Grade 7/8 Math Circles Game Theory October 27/28, 2015

WPF PUZZLE GP 2018 ROUND 1 COMPETITION BOOKLET. Host Country: Turkey. Serkan Yürekli, Salih Alan, Fatih Kamer Anda, Murat Can Tonta A B H G A B I H

WPF PUZZLE GP 2018 ROUND 7 INSTRUCTION BOOKLET. Host Country: Netherlands. Bram de Laat. Special Notes: None.

Do not duplicate or distribute without written permission from CMKC!

Today s Topics. Sometimes when counting a set, we count the same item more than once

Kenken For Teachers. Tom Davis January 8, Abstract

Grade 6 Math Circles February 21/22, Patterns - Solutions

6.1 Basics of counting

UNIVERSITY OF NORTHERN COLORADO MATHEMATICS CONTEST

Math Stories and Games: Logic, Patterns and Mathematical Thinking

INTERNATIONAL MATHEMATICS TOURNAMENT OF TOWNS Junior A-Level Paper, Spring 2014.

Sponsored by IBM. 2. All programs will be re-compiled prior to testing with the judges data.

Croatian Olympiad in Informatics 2002

Problem C The Stern-Brocot Number System Input: standard input Output: standard output

Preview Puzzle Instructions U.S. Sudoku Team Qualifying Test September 6, 2015

Review I. October 14, 2008

Tapa Variations Contest

PART 2 VARIA 1 TEAM FRANCE WSC minutes 750 points

Croatian Open Competition in Informatics, contest 2 November 25, 2006

5CHAMPIONSHIP. Individual Round Puzzle Examples SUDOKU. th WORLD. from PHILADELPHIA. Lead Sponsor

a) Write the numbers from 0 to 20 in increasing order.

WPF PUZZLE GP 2016 ROUND 8 INSTRUCTION BOOKLET. Host Country: Russia. Andrey Bogdanov. Special Notes: No special notes for this round.

1. Hex Tapa (12 points) 2. Hex Dominos (13 points)

Problem A. Jumbled Compass

Math 1111 Math Exam Study Guide

International Contest-Game MATH KANGAROO

Introduction to Mathematical Reasoning, Saylor 111

Wordy Problems for MathyTeachers

What is the sum of the positive integer factors of 12?

Multiplication and Division MODELS

Junior Questions: Part A

Pascal Contest (Grade 9)

INTERMEDIATE. Grades 8 and 9 NOT TO BE USED BEFORE 5 MARCH If you are NOT in grades 8 or 9, please report that you have the wrong paper.

Chapter 4: Patterns and Relationships

WPF PUZZLE GP 2018 ROUND 2 INSTRUCTION BOOKLET. Host Country: Switzerland. Markus Roth, Roger Kohler, Esther Naef

KÄNGURU DER MATHEMATIK

Grade 6 Math Circles Combinatorial Games - Solutions November 3/4, 2015

Part A. 1. How many seconds are there in sixty-two minutes? (A) 62 (B) 3602 (C) 3620 (D) 3680 (E) 3720 (C) 3 8 (A) 7 (B) 11 (C) 13 (D) 15 (E) 17

Once you get a solution draw it below, showing which three pennies you moved and where you moved them to. My Solution:

Inductive Reasoning Practice Test. Solution Booklet. 1

Grade 6 Math Circles Combinatorial Games November 3/4, 2015

Grade 6 Math Circles February 21/22, Patterns

The Canadian Open Mathematics Challenge November 3/4, 2016

Episode 4 30 th March 2 nd April 2018 Odd Even & Substitution Variations By R Kumaresan and Amit Sowani

Hibiscus Flowers. * Original image copyright of Clker Images - Pixabay. Cross Stitch Design by Tereena Clarke.

100 IDEAS FOR USING A HUNDRED SQUARE

Basil wants to paint the word KANGAROO. He paints one letter each day. He starts on Wednesday. On what day will he paint the last letter?

MATHEMATICAL RELATIONAL SKILLS AND COUNTING

TASK ŠEĆER KOLO GITARA POŠTAR KUGLICE UPIT. kolo.pas kolo.c kolo.cpp. gitara.pas gitara.c gitara.cpp

Mt. Douglas Secondary

ShillerMath Book 1 Test Answers

Senior Math Circles February 10, 2010 Game Theory II

International Contest-Game MATH KANGAROO Canada, 2007

IN THIS ISSUE. Cave vs. Pentagroups

Inside Outside Circles Outside Circles Inside. Regions Circles Inside Regions Outside Regions. Outside Inside Regions Circles Inside Outside

Comparing Methods for Solving Kuromasu Puzzles

Problem A. Backward numbers. backw.in backw.out

2017 Beaver Computing Challenge (Grade 7 & 8) Questions

High School Programming Tournament. Problems

UK SENIOR MATHEMATICAL CHALLENGE

Transcription:

TASK SKOCIMIS PTICE MRAVOJED JEZ SKAKAVAC KRTICA standard standard time limit 1 second 1 second 1 second 1 second 4 seconds 3 seconds memory limit 32 MB 32 MB 32 MB 32 MB 35 MB 128 MB points 30 40 70 100 120 140 500

Task SKOCIMIS Three kangaroos are playing in the desert. They are playing on a number line, each occupying a different integer. In a single move, one of the outer kangaroos jumps into the space between the other two. At no point may two kangaroos occupy the same position. Help them play as long as possible. Three integers A, B and C (0 < A < B < C < 100), the initial positions of the kangaroos. Output the largest number of moves the kangaroos can make. 2 3 5 1 3 5 9 3

Task PTICE Adrian, Bruno and Goran wanted to join the bird lovers' club. However, they did not know that all applicants must pass an entrance exam. The exam consists of N questions, each with three possible answers: A, B and C. Unfortunately, they couldn't tell a bird from a whale so they are trying to guess the correct answers. Each of the three boys has a theory of what set of answers will work best: Adrian claims that the best sequence is: A, B, C, A, B, C, A, B, C, A, B, C... Bruno is convinced that this is better: B, A, B, C, B, A, B, C, B, A, B, C... Goran laughs at them and will use this sequence: C, C, A, A, B, B, C, C, A, A, B, B... Write a program that, given the correct answers to the exam, determines who of the three was right whose sequence contains the most correct answers. The first line contains an integer N (1 N 100), the number of questions on the exam. The second line contains a string of N letters 'A', 'B' and 'C'. These are, in order, the correct answers to the questions in the exam. On the first line, M, the largest number of correct answers one of the three boys gets. After that, the names of the boys (in alphabetical order) whose sequences result in M correct answers. 5 BAACC 3 Bruno 9 AAAABBBBB 4 Adrian Bruno Goran

Task MRAVOJED Archeologists recently found the remains of Greco-Roman architecture. The location can be modeled as a grid of R C square cells. For each of the cells, archeologists have determined if some building was there or if the cell has always been empty. After examining the artifacts in detail, they concluded that the location contains two buildings from different periods in time, and that the floor plans of both buildings are of square shape. Because the buildings were from different periods in time, it is possible that their floor plans overlap. Determine the possible location and size (length of the side of the square occupied by the floor plan) for each building. The first line contains two integers R (1 R 100) and C (1 C 100), the size of the location. Each of the next R lines contains a strong of C characters '.' (dot) or 'x' (lowercase letter). The character '.' means that nothing was found in that cell, while 'x' indicates that there was a building there. For each of the two buildings, on a single line the row and column of its upper left corner, and the size of the building. Note: The test data will guarantee that a solution always exists, although it may not necessarily be unique. 3 3 xx. xxx... 1 1 2 2 3 1 4 6 xx... xx.xxx...xxx...xxx 1 1 2 2 4 3 5 5... xxx.. xxxx. xxxx..xxx. 2 1 3 3 2 3

Task JEZ Luka found a very unusual game board in his attic. Surprisingly, it consists of R C square cells. The rows are numbered 0 to R 1 top to bottom and the columns 0 to C 1 left to right. What makes the board unusual is the way in which the cells are coloured. Each cell is either grey or white: white, if the row and column numbers of the cell, when represented in binary, have at least one digit 1 in the same position. For example, the cell (4, 5) would be white. grey, otherwise. For example, the cell (2, 5) would be grey. The following image shows a board of size 10 10. Luka's hedgehog likes walking on this unusual board and does it in an unusual way. The hedgehog starts his walk in the cell (0, 0) and continues in the zig-zag pattern as in the second image above. While the hedgehog is walking, Luka counts how many grey squares it visited. After visiting K squares, the hedgehog gets tired and falls asleep. Luka then goes to bed too, happy that he was able count the grey squares. Knowing the dimensions of the board and the number K beforehand, however, it is possible to write a program that calculates the result faster. This is your task. The first line contains two integers R (1 R 1 000 000) and C (1 C 1 000 000), the dimensions of the board. The second line contains the integer K (1 K R C), the total number of squares the hedgehog visits. Note that this number may not fit in a 32-bit integer. Output the number of grey cells the hedgehog visits.

Task JEZ GRADING In test cases worth 50% of points, K will be less than 1 000 000. 10 10 6 5 3 5 11 8 10 10 100 51

Task SKAKAVAC A grasshopper is in a flower field. The field contains N N flowers arranged in N rows and N columns. For each flower in the field, we know how many petals it has. The grasshopper is initially on the flower in row R and column C. Its goal is to visit as many flowers as possible while obeying these rules: 1. It can only jump into an adjacent row or column. If it jumps into the adjacent row, it must jump at least two columns, and if it jumps into the adjacent column, it must jump at least two rows. In other words, it can jump from flower (r 1, c 1 ) to flower (r 2, c 2 ) if: r 1 -r 2 = 1 and c 1 -c 2 > 1 or c 1 -c 2 = 1 and r 1 -r 2 > 1 2. The number of petals on the next flower must be strictly larger than the number of petals on the previous flower. Write a program that calculates the largest number of flowers the grasshopper can visit. The first line contains the integer N (1 N 1500), the size of the field. The second line contains integers R (1 R N) and C (1 C N), the grasshopper's initial position. The next N lines contain N positive integers separated by spaces, each less than 1 000 000, the numbers of petals on the flowers. Output a single integer the largest number of flowers the grasshopper can visit. GRADING In test data worth 50% of points, N will be at most 100. In test data worth 80% of points, N will be at most 1000. 4 1 1 1 2 3 4 2 3 4 5 3 4 5 6 4 5 6 7 4 5 3 3 20 16 25 17 12 11 13 13 30 17 15 29 10 26 11 27 19 14 24 22 23 21 28 18 13 21

Task KRTICA Moles are tidy and hard-working animals. Our mole likes to keep its underground residence in utmost order, so that everyone living there knows where to find things. To achieve this, the mole connected rooms with tunnels so that there is a single unique way to get from one room to any other room. The distance between two rooms is the number of halls passed on the way from one to the other. Despite all the effort, some of the mole's guests are complaining that it takes too long to walk between certain pairs of rooms. The mole decided to reconstruct her residence, closing one tunnel and opening a new one, so that the distance between the farthest two rooms is the smallest possible, but so that it is still possible to reach every room from every other room. Write a program which determines the distance between the farthest two rooms after reconstruction, which tunnel to close and which to open. The first line contains an integer N (1 N 300 000), the number of rooms. The rooms are numbered 1 to N. Each of the next N 1 lines contains two integers, the numbers of rooms a tunnel connects. Output on separate lines, in order: The distance between the two farthest rooms after reconstruction. A pair of integers representing a previously existing tunnel, which should be closed. A pair of integers, the rooms between which a new tunnel should be opened. Note: The solution will not necessarily be unique. Output any reconstruction plan which achieves the smallest distance between the farthest two rooms.

Task KRTICA GRADING In test cases worth 40% of points, N will be less than 30. In test cases worth 70% of points, N will be less than 3000. Additionally, if the first line of your is correct and the other two are missing or incorrect, you will receive about 70% of the value of that test case. 4 1 2 2 3 3 4 2 3 4 4 2 7 1 3 2 3 2 7 4 3 7 5 3 6 3 2 3 7 3