South African Computer Olympiad Web Training, 2009 IOI Squad March Contest. Overview. Michiel Baird. Problem bnumbers hotdates connect wifitow

Similar documents
South African Computer Olympiad Web Training, 2009 IOI Squad May Contest. Overview. Schalk- Willem. Problem tile destroy jelly tiles

The Canadian Open Mathematics Challenge November 3/4, 2016

Intermediate Mathematics League of Eastern Massachusetts

Problem A: Watch the Skies!

Cayley Contest (Grade 10) Thursday, February 25, 2010

COMPONENTS: No token counts are meant to be limited. If you run out, find more.

2016 Canadian Computing Olympiad Day 2, Problem 1 O Canada

Q i e v e 1 N,Q 5000

2005 Galois Contest Wednesday, April 20, 2005

2013 ACM ICPC Southeast USA Regional Programming Contest. 2 November, Division 1

South African Computer Olympiad Final Round Day 2. Overview. Carruthers- Smith Problem parrots seen search. seen.java seen.py seen.c seen.cpp seen.

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

APMOPS MOCK Test questions, 2 hours. No calculators used.

Algebra/Geometry Session Problems Questions 1-20 multiple choice

UNC Charlotte 2002 Comprehensive. March 4, 2002

Probability Paradoxes

Organization Team Team ID# If each of the congruent figures has area 1, what is the area of the square?

Some Shoppers Will Only Call a Business With Reviews

CS100: DISCRETE STRUCTURES. Lecture 8 Counting - CH6

2015 ACM ICPC Southeast USA Regional Programming Contest. Division 1

7. Three friends each order a large

Chapter 4 Number Theory

March 5, What is the area (in square units) of the region in the first quadrant defined by 18 x + y 20?

Sec 5.1 The Basics of Counting

CS 32 Puzzles, Games & Algorithms Fall 2013

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

Mathematics Behind Game Shows The Best Way to Play

Let me ask you one important question.

Name: Exam Score: /100. Exam 1: Version C. Academic Honesty Pledge

The Eighth Annual Student Programming Contest. of the CCSC Southeastern Region. Saturday, November 3, :00 A.M. 12:00 P.M.

Sequential games. We may play the dating game as a sequential game. In this case, one player, say Connie, makes a choice before the other.

Assignment 2. Due: Monday Oct. 15, :59pm

a) Getting 10 +/- 2 head in 20 tosses is the same probability as getting +/- heads in 320 tosses

COUNTING TECHNIQUES. Prepared by Engr. JP Timola Reference: Discrete Math by Kenneth H. Rosen

The 2016 ACM-ICPC Asia China-Final Contest Problems

Table of Contents. Table of Contents 1

Card Racer. By Brad Bachelor and Mike Nicholson

Team Round University of South Carolina Math Contest, 2018

Problem 2A Consider 101 natural numbers not exceeding 200. Prove that at least one of them is divisible by another one.

Olympiad Combinatorics. Pranav A. Sriram

1. An office building contains 27 floors and has 37 offices on each floor. How many offices are in the building?

mywbut.com Two agent games : alpha beta pruning

DIVISION II (Grades 2-3) Common Rules

1999 Gauss Solutions 11 GRADE 8 (C) 1 5

MAT points Impact on Course Grade: approximately 10%

The Product Rule can be viewed as counting the number of elements in the Cartesian product of the finite sets

State Math Contest (Junior)

Contest 1. October 20, 2009

4. The terms of a sequence of positive integers satisfy an+3 = an+2(an+1 + an), for n = 1, 2, 3,... If a6 = 8820, what is a7?

Jamie Mulholland, Simon Fraser University

PIGEONHOLE PRINCIPLE

Instructions [CT+PT Treatment]

Coimisiún na Scrúduithe Stáit State Examinations Commission. Junior Certificate Examination Mathematics. Paper 2 Higher Level

UCF Local Contest August 31, 2013

YEAR 9 (13+) ENTRANCE EXAMINATION. April 2016 for entry in September 2017 MATHEMATICS. Your Name: Your School:

Would You Like To Earn $1000 s With The Click Of A Button?

Daniel Plotnick. November 5 th, 2017 Mock (Practice) AMC 8 Welcome!

GROUP ROUND INSTRUCTIONS

Final Exam, Math 6105

Review I. October 14, 2008

1. The sides of a cube are increased by 100%. By how many percent 1. percent does the volume of the cube increase?

12. 6 jokes are minimal.

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

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

MUMS Problem Solving Competition. Melbourne University Mathematics and Statistics Society

4th Pui Ching Invitational Mathematics Competition. Final Event (Secondary 1)

Looking for a fun math ipad app? The Tic Tac Math series is available in the App Store on itunes. Check it out!

martin wallace rules book MAD SCIENTISTS AND ATOMIC MONSTERS ATTACK THE earth

LESSON 7. Interfering with Declarer. General Concepts. General Introduction. Group Activities. Sample Deals

Lesson 7: Calculating Probabilities of Compound Events

Date. Probability. Chapter

Discrete Mathematics. Spring 2017

HIGH SCHOOL - PROBLEMS

BOB s 5 PHASES of DEFENSE AT DUPLICATE

With Question/Answer Animations. Chapter 6

2014 ACM ICPC Southeast USA Regional Programming Contest. 15 November, Division 1

COUNTING AND PROBABILITY

UCI Math Circle October 10, Clock Arithmetic

Number Bases. Ideally this should lead to discussions on polynomials see Polynomials Question Sheet.

Class 6 CHAPTER 1 KNOWING OUR NUMBERS

Know how to add positive and negative numbers Know how to use the sign change key on a calculator

STUDENT S BOOKLET. Geometry 2. Contents. Meeting 7 Student s Booklet. May 24 UCI. 1 Circular Mountains 2 Rotations

Individual 5 th Grade

intermediate Division Competition Paper

Take one! Rules: Two players take turns taking away 1 chip at a time from a pile of chips. The player who takes the last chip wins.

BmMT 2013 TEAM ROUND SOLUTIONS 16 November 2013

The Galaxy. Christopher Gutierrez, Brenda Garcia, Katrina Nieh. August 18, 2012

Solutions to the European Kangaroo Pink Paper

Math Contest Preparation II

Outline. Content The basics of counting The pigeonhole principle Reading Chapter 5 IRIS H.-R. JIANG

Math is Cool Masters

Pascal Contest (Grade 9)

RMT 2015 Power Round Solutions February 14, 2015

BAPC The Problem Set

MATH 215 DISCRETE MATHEMATICS INSTRUCTOR: P. WENG

Mathematics Test. Go on to next page

Problem Darts Input File: DartsIn.txt Output File: DartsOut.txt Project File: Darts

SOLITAIRE CLOBBER AS AN OPTIMIZATION PROBLEM ON WORDS

Class 6 Natural and Whole Numbers

junior Division Competition Paper

Transcription:

Overview Author(s) Kosie van der Merwe Michiel Baird Graham Manuell Schalk- Willem Krüger Problem bnumbers hotdates connect wifitow Source bnumbers.c bnumbers.cpp hotdates.c hotdates.cpp connect.c connect.cpp wifitow.c wifitow.cpp Input file stdin stdin stdin stdin Output file stdout stdout stdout stdout 1 second 1 second 1 second 1 second Number of tests 10 10 10 10 Points per test 10 10 10 10 Yes Yes No Yes Total points 100 100 100 100 The maximum total score is 400 points. https://olympiad.cs.uct.ac.za/contests/web-2009/

Beautiful Numbers Kosie van der Merwe Bruce and Carl decided to start their own software company, called Good And Evil Tech. They have commissioned you to test their proposed copy protection system or at least help to. As can be expected they are very secretive of the actual algorithm so they will only let you see a part of it. They are saying something about finding the number of Beautiful Numbers, but are mysteriously tight lipped about what a Beautiful Number might be used for and they just barely wanted to tell you what one actually is... The task they want you to help with is counting the number of Beautiful Numbers that satisfy the given restrictions and then tell them the remainder of the count after division by 1 000 000 007. You are given the base the number is in, N, and the maximum number of digits the number may consist of, M. So you must consider all numbers that are at most M digits long when written in base N. None of the numbers may start with 0, including the number 0, and consecutive digits must differ by exactly 1, for instance the number in base 10, 987654210, satisfies the two mentioned conditions. Lastly they want all numbers to use all the available digits in that base, i.e. the digits from 0 to N 1 must be used in the number. A number that meets the above requirements is called a Beautiful Number. The input consists of a single line with 2 space separated integers: N and M. 2 4 The output consists only of a single integer on one line: the remainder of the number of Beautiful Numbers after division by 1 000 000 007 In all test cases the following holds: 1 N 10 0 M 100 Additionally, in 50% of the test cases: 1 N M 10 000 000 000 Additionally, in 0% of the test cases: 1 N M 100 000 Consider you are told N is 2 and M is 4. 0 isn t a Beautiful Number because it isn t allowed nor does it contain the digits from 0 to 1 (N 1). Similarly 1 isn t a Beautiful Number because it doesn t contain all the digits from 0 to 1. 01 isn t one as well because it starts with 0. 10 is however a Beautiful Number because the digits differ by 1, it contains all the digits (0 to 1) and doesn t start with 0. 110 isn t a valid Beautiful Number because its consecutive digits don t differ by one, although it meets all the other requirements. So the only Beautiful Numbers for N = 2 and M = 4 are 10, 101 and 1010. Thus the answer is. A correct solution will score 100, while an incorrect solution will score 0.

Hot Dates Michiel Baird Hot Dates is a brand new dating agency. Their first week of set ups went quite bad as everyone left with someone different to the one they were set up with. They need to stop this as their clients are refusing to pay. They decided to give each person a survey. The survey asks each person to rate the group of the opposite sex, giving them a score from 1 to 1000. Given the survey scores for N males and N females, find a pairing that is stable. That is, for each pair of couples there are no such 2 people of the opposite sex that would prefer to be with each other than their current partners. NOTE: There might be multiple stable set-ups you only need to find one of them. Given the survey scores of males and females. Male Survey Female 1 Female 2 Female Male 1 20 10 15 Male 2 17 10 15 Male 50 45 40 Female Survey Male 1 Male 2 Male Female 1 0 10 1 Female 2 10 10 50 Female 60 20 1 A stable dating set up would be: Male 1 and Female 1 Male 2 and Female Male and Female 2 male. The line contains N space-separated integers, containing the score for each female. The last N lines contains the survey scores for each female, in the same format as the male survey. 20 10 15 17 10 15 50 45 40 0 10 1 10 100 50 60 20 1 The output contains N lines. The ith line contains the integer of the female that male i should be set up with. 1 2 1 N 1 000 1 S ij 1 000 for each survey score Additionally, in 0% of the test cases: 1 N 9 The first line contains a single integer N The next N lines contains the survey score for each

Connecting the Grid Graham Manuell Mark and James are playing a game on an grid with N blocks (labelled 1 to N), in which the players take turns to join two blocks. A block may be joined to multiple other blocks (adjacent or otherwise), but not to itself. However, any pair of blocks may only be connected once, and only one connection may be made per turn. Naturally, if A is connected to B, so is B to A. The aim of the game is to form as many cycles as possible, as shown in the diagram. One point is awarded for each turn in which a cycle is created. Only one point may be obtained per turn, regardless of the number of cycles formed in the turn. These games can become quite intense and could take many moves before the player with the most points is declared the winner. Mark and James do not trust each other to keep score and have thus appointed you as the impartial umpire. You will be presented with a sequence of the K moves played, alternating between players, with Mark going first. You will be required to find the total score of each player. Despite many nights of playing the game, Mark and James are not guaranteed to play optimally. Mark goes first and links 2 to ; James links 12 to 1. Then Mark links 2 to 12 and James links to 12, forming a cycle. Finally, Mark links 1 to, forming multiple cycles of his own. The first line of the input contains two space-separated integers, N and K. The next K lines each contain two space-separated integers, A i and B i, the blocks to be connected. 20 5 2 12 1 2 12 12 1 Output two space-separated integers, the scores of Mark and James respectively. 1 1 2 N 100 000 000 2 K 800 000 1 A i, B i N for each move Additionally, in 50% of the test cases: K 1 000 Additionally, in 70% of the test cases: N 1 000 000

WiFi Tower Schalk-Willem Krüger Bruce wants to start his own political party. To win some votes, he decides to put up a huge wireless tower in order to give all his potential voters free internet. The tower covers a circular area with the tower as the midpoint. Because Bruce doesn t want to waste money, he wants to make the signal strength of the tower as small as possible. The signal must still reach all the potential voters. Help Bruce to decide where to put the tower and what the signal s radius must be. Write a program that will, given the (x,y) positions of all the potential voters, calculate the radius and midpoint of the smallest enclosing circle that covers the voters. The tower s coverage includes the circumfence of the circle as well as the area inside it. Suppose there are seven voters at positions (1,1), (2,), (4,4), (5,1), (4,), (4,2). The smallest enclosing circle that covers all the points have a radius of 2.24 units and a midpoint at (,2). The output should consists of two lines. The first line must contain a single number representing the radius of the minimum enclosing circle, rounded off to two decimal places. The second line must contain two space-separated numbers, rounded off to two decimal places that represents the coordinate of the midpoint. 2.24.00 2.00 1 N 100 000 0 x, y 1 000 000 for each position of a potensial voter Additionally, in 0% of the test cases: 1 N 1 000 The first line of input contains a single number N. The next N lines each contain two space-separated integers, x and y. (x, y) represents a potential voter. All points are unique. 6 1 1 2 4 4 5 1 4 4 2