NCPC 2007 Problem A: Phone List 3. Problem A. Phone List

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

Canadian Computing Competition

Lecture 2 Video Formation and Representation

Table of Contents. Introduction...v. About the CD-ROM...vi. Standards Correlations... vii. Ratios and Proportional Relationships...

N12/5/MATSD/SP2/ENG/TZ0/XX. mathematical STUDIES. Wednesday 7 November 2012 (morning) 1 hour 30 minutes. instructions to candidates

MA 15910, Lesson 5, Algebra part of text, Sections 2.3, 2.4, and 7.5 Solving Applied Problems

x) Graph the function

Product catalogue 2008

Bite Size Brownies. Designed by: Jonathan Thompson George Mason University, COMPLETE Math

1 Boxer Billy Input File: BoxerBillyIn.txt

Please note we do have some regular volunteer technicians but there is no full time technical manager.

Real-Time Systems Dr. Rajib Mall Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Fill out the following table: Solid #1 Solid #2 Volume. Number of Peanuts. Ratio

Increasing Capacity of Cellular WiMAX Networks by Interference Coordination

The Lewisham. Town Centre Trail

EOC FINAL REVIEW Name Due Date

Lesson 25: Solving Problems in Two Ways Rates and Algebra

Formula of the sieve of Eratosthenes. Abstract

OEM Basics. Introduction to LED types, Installation methods and computer management systems.

Training Note TR-06RD. Schedules. Schedule types

AskDrCallahan Calculus 1 Teacher s Guide

CHAPTER 2. Black and White Television Systems

Functional Mathematics

MODIFYING A SMALL 12V OPEN FRAME INDUSTRIAL VIDEO MONITOR TO BECOME A 525/625 & 405 LINE MULTI - STANDARD MAINS POWERED UNIT. H. Holden. (Dec.

Chapter 1 Midterm Review

Here s a question for you: What happens if we try to go the other way? For instance:

Lesson 70: Shopping (20-25 minutes)

Data Representation. signals can vary continuously across an infinite range of values e.g., frequencies on an old-fashioned radio with a dial

Technical Pack. Attenborough Arts Centre

FINAL REVIEW m rounded to the nearest centimeter is _. Choose the correct answer, and write its number in the parentheses.

Interlace and De-interlace Application on Video

/$ IEEE

Setting Up the Warp System File: Warp Theater Set-up.doc 25 MAY 04

Subtitle Safe Crop Area SCA

Sources of Error in Time Interval Measurements

GCSE MARKING SCHEME AUTUMN 2017 GCSE MATHEMATICS NUMERACY UNIT 1 - INTERMEDIATE TIER 3310U30-1. WJEC CBAC Ltd.

Version : 27 June General Certificate of Secondary Education June Foundation Unit 1. Final. Mark Scheme

Blueline, Linefree, Accuracy Ratio, & Moving Absolute Mean Ratio Charts

Video coding standards

DATA COMPRESSION USING THE FFT

FASCIA SIGNAGE CONFIRMATION FORM

Automatic Transistor-Level Design and Layout Placement of FPGA Logic and Routing from an Architectural Specification

The CAAMA Building and Fit Out

Design Review Board Minutes of Meeting April 6, Cheryl McGuire, Jim Goldsmith, Tim Berres, Tim Hart, Bob Turgeon, Ron Litten

The Standard Bank Studio is a music venue made from the choir stalls and the stage of the Cape Town City Hall Auditorium. It

Event Guidelines. The Qt Company

Delta College Middle School Math Competition Practice Test A 2018

UPU 5000 Inline Delamination Detection and Process Trending with the Ultrasonic Measuring System

TEST 4 MATHEMATICS. Name:. Date of birth:. Primary School:. Today s date:.

may 2016 brand guide

La Bohème. Act 1,4. Act 2

UNIT 3 Past simple OJ Circle the right words in each sentence.

Analyzing Numerical Data: Using Ratios I.B Student Activity Sheet 4: Ratios in the Media

AP Statistics Sec 5.1: An Exercise in Sampling: The Corn Field

12-bit Wallace Tree Multiplier CMPEN 411 Final Report Matthew Poremba 5/1/2009

Choices and Constraints: Pattern Formation in Oriental Carpets

Alternative: purchase a laptop 3) The design of the case does not allow for maximum airflow. Alternative: purchase a cooling pad

San Ġorġ Preca College Secondary School, Blata l-bajda Half-Yearly Examinations - February 2015

Individual Project Report

Problem Set 8. MIT students: Each problem should be done on a separate sheet (or sheets) of three-hole punched paper.

The Merry Wives of Windsor

Instructions for WiP Relay Block Kit

SIMULATION MODELING FOR QUALITY AND PRODUCTIVITY IN STEEL CORD MANUFACTURING

A Magical Vacation? Preparatory Reading TALKING ABOUT TRAVEL, PAST SIMPLE TENSE ADJECTIVES, ASKING FOLLOW-UP QUESTIONS

STUDENTS EXPERIENCES OF EQUIVALENCE RELATIONS

Preliminaries. for the Benelux Algorithm Programming Contest. Problems

DVG-5000 Motion Pattern Option

PE4. English Literacy 2017/2018. Name / Surname(s): School: Group: City / Town: Date: Year 4 of Primary Education

THE CABLE TRAY SYSTEM

Answer all questions. No marks will be awarded for using brand names of software packages or hardware.

Hardware Implementation for the HEVC Fractional Motion Estimation Targeting Real-Time and Low-Energy

On-Supporting Energy Balanced K-Barrier Coverage In Wireless Sensor Networks

SEQUENTIAL LOGIC. Satish Chandra Assistant Professor Department of Physics P P N College, Kanpur

Cosmos2 The Economical X-ray Solution with the Best Image Quality and High Reliability

Part 1: Introduction to Computer Graphics

EVOLVING DESIGN LAYOUT CASES TO SATISFY FENG SHUI CONSTRAINTS

Digital Audio and Video Fidelity. Ken Wacks, Ph.D.

315 Clinton Street, Binghamton, NY (607) FAX: (607) HOME PAGE:

INSTALATION PROCEDURE

PE4. English Literacy 2017/2018. Name / Surname(s): School: Group: City / Town: Date: Year 4 of Primary Education

Math and Music. Cameron Franc

Post-Routing Layer Assignment for Double Patterning

Maths-Whizz Investigations Paper-Back Book

(Refer Slide Time 1:58)

What is Statistics? 13.1 What is Statistics? Statistics

Projector solutions. Display size matters in education

How to Obtain a Good Stereo Sound Stage in Cars

Bin Gallery Membership Information Membership Year

Discovery of frequent episodes in event sequences

Ultimate Music Theory Basic Rudiments

18-551, Spring Group #4 Final Report. Get in the Game. Nick Lahr (nlahr) Bryan Murawski (bmurawsk) Chris Schnieder (cschneid)

C A R G O C O N T R O L. By Fritz Dahlin

UNIVERSITY OF CAMBRIDGE INTERNATIONAL EXAMINATIONS International General Certificate of Secondary Education. Paper 1 May/June hours 30 minutes

ACOUSTICAL SOLUTIONS IN MODERN ARCHITECTURE

Module 8 VIDEO CODING STANDARDS. Version 2 ECE IIT, Kharagpur

YOUR QUOTE SUMMARY Dubai International Academy

ONE SENSOR MICROPHONE ARRAY APPLICATION IN SOURCE LOCALIZATION. Hsin-Chu, Taiwan

Optimal Television Adverts Selection, Case Study: Ghana Television (GTV)

Audio Compression Technology for Voice Transmission

DW Consulting B.V. Preliminary Draft For Customer Approval

Transcription:

NCPC 2007 Problem A: Phone List 3 Problem A Phone List Given a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let s say the phone catalogue listed these numbers: Emergency 911 Alice 97 625 999 Bob 91 12 54 26 In this case, it s not possible to call Bob, because the central would direct your call to the emergency line as soon as you had dialled the first three digits of Bob s phone number. So this list would not be consistent. The first line of input gives a single integer, 1 t 40, the number of test cases. Each test case starts with n, the number of phone numbers, on a separate line, 1 n 10000. Then follows n lines with one unique phone number on each line. A phone number is a sequence of at most ten digits. For each test case, output YES if the list is consistent, or NO otherwise. Sample input 2 3 911 97625999 91125426 5 113 12340 123440 12345 98346 Output for sample input NO YES

NCPC 2008 Problem B: Best Compression Ever 3 Problem B Best Compression Ever Being educated in Computer Science and Mathematics is not always easy. Especially not if you have friends who repeatedly insist on showing you their new proofs that P equals NP, that the Riemann Hypothesis is true, and so on. One of your friends recently claims to have found a fantastic new compression algorithm. As an example of its amazing performance, your friend has told you that every file in your precious collection of random bit strings after compression would be at most b bits long! Naturally, you find this a bit hard to believe, so you want to determine whether it is even theoretically possible for this to be true. Your collection of random bit strings consists of N files, no two of which are identical, and each of which is exactly 1000 bits long. The input consists of two integers N (1 N 10 15 ) and b (0 b 50), giving the number of files in your collection and the maximum number of bits a compressed file is allowed to have. Output a line containing either yes if it is possible to compress all the N files in your collection into files of size at most b bits, or no otherwise. Sample input 1 Sample output 1 13 3 yes Sample input 2 Sample output 2 1 0 yes Sample input 3 Sample output 3 31415926535897 40 no

NCPC 2007 Problem C: Optimal Parking 7 Problem C Optimal Parking When shopping on Long Street, Michael usually parks his car at some random location, and then walks to the stores he needs. Can you help Michael choose a place to park which minimises the distance he needs to walk on his shopping round? Long Street is a straight line, where all positions are integer. You pay for parking in a specific slot, which is an integer position on Long Street. Michael does not want to pay for more than one parking though. He is very strong, and does not mind carrying all the bags around. The first line of input gives the number of test cases, 1 t 100. There are two lines for each test case. The first gives the number of stores Michael wants to visit, 1 n 20, and the second gives their n integer positions on Long Street, 0 x i 99. Output for each test case a line with the minimal distance Michael must walk given optimal parking. Sample input 2 4 24 13 89 37 6 7 30 41 14 39 42 Output for sample input 152 70

NCPC 2008 Problem E: Event Planning 9 Problem E Event Planning As you didn t show up to the yearly general meeting of the Nordic Club of Pin Collectors, you were unanimously elected to organize this years excursion to Pin City. You are free to choose from a number of weekends this autumn, and have to find a suitable hotel to stay at, preferably as cheap as possible. You have some constraints: The total cost of the trip must be within budget, of course. All participants must stay at the same hotel, to avoid last years catastrophe, where some members got lost in the city, never being seen again. The first line of input consists of four integers: 1 N 200, the number of participants, 1 B 500000, the budget, 1 H 18, the number of hotels to consider, and 1 W 13, the number of weeks you can choose between. Then follow two lines for each of the H hotels. The first gives 1 p 10000, the price for one person staying the weekend at the hotel. The second contains W integers, 0 a 1000, giving the number of available beds for each weekend at the hotel. Output the minimum cost of the stay for your group, or stay home if nothing can be found within the budget. Sample input 1 Sample output 1 3 1000 2 3 200 0 2 2 300 27 3 20 900 Sample input 2 Sample output 2 5 2000 2 4 300 4 3 0 4 450 7 8 0 13 stay home

NCPC 2008 Problem G: Getting Gold 13 Problem G Getting Gold We re building an old-school back-to-basics computer game. It s a very simple text based adventure game where you walk around and try to find treasure, avoiding falling into traps. The game is played on a rectangular grid and the player gets very limited information about her surroundings. The game will consist of the player moving around on the grid for as long as she likes (or until she falls into a trap). The player can move up, down, left and right (but not diagonally). She will pick up gold if she walks into the same square as the gold is. If the player stands next to (i.e., immediately up, down, left, or right of) one or more traps, she will sense a draft but will not know from what direction the draft comes, or how many traps she s near. If she tries to walk into a square containing a wall, she will notice that there is a wall in that direction and remain in the position where she was. For scoring purposes, we want to show the player how much gold she could have gotten safely. That is, how much gold can a player get playing with an optimal strategy and always being sure that the square she walked into was safe. The player does not have access to the map and the maps are randomly generated for each game so she has no previous knowledge of the game. The first line of input contains two positive integers W and H, neither of them smaller than 3 or larger than 50, giving the width and the height of the map, respectively. The next H lines contain W characters each, giving the map. The symbols that may occur in a map are as follows: P the player s starting position G a piece of gold T atrap # awall. normal floor There will be exactly one P in the map, and the border of the map will always contain walls. Output the number of pieces of gold the player can get without risking falling into a trap.

14 NCPC 2008 Problem G: Getting Gold Sample input 1 Sample output 1 7 4 ####### #P.GTG# #..TGG# ####### 1 Sample input 2 Sample output 2 8 6 ######## #...GTG# #..PG.G# #...G#G# #..TG.G# ######## 4

NCPC 2007 Problem H: Shopaholic 17 Problem H Shopaholic Lindsay is a shopaholic. Whenever there is a discount of the kind where you can buy three items and only pay for two, she goes completely mad and feels a need to buy all items in the store. You have given up on curing her for this disease, but try to limit its effect on her wallet. You have realized that the stores coming with these offers are quite selective when it comes to which items you get for free; it is always the cheapest ones. As an example, when your friend comes to the counter with seven items, costing 400, 350, 300, 250, 200, 150, and 100 dollars, she will have to pay 1500 dollars. In this case she got a discount of 250 dollars. You realize that if she goes to the counter three times, she might get a bigger discount. E.g. if she goes with the items that costs 400, 300 and 250, she will get a discount of 250 the first round. The next round she brings the item that costs 150 giving no extra discount, but the third round she takes the last items that costs 350, 200 and 100 giving a discount of an additional 100 dollars, adding up to a total discount of 350. Your job is to find the maximum discount Lindsay can get. The first line of input gives the number of test scenarios, 1 t 20. Each scenario consists of two lines of input. The first gives the number of items Lindsay is buying, 1 n 20000. The next line gives the prices of these items, 1 p i 20000. For each scenario, output one line giving the maximum discount Lindsay can get by selectively choosing which items she brings to the counter at the same time. Sample input 1 6 400 100 200 350 300 250 Output for sample input 400

NCPC 2007 Problem I: Moogle 19 Problem I Moogle You got the original idea of making map software, called Moogle Maps, for the new cool Maple mphone. It will even be capable of indicating the location of a house address like Main Street 13. However, since the mphone has limited storage capacity, you need to reduce the data amount. You don t want to store the exact location of every single house number. Instead only a subset of the house numbers will be stored exactly, and the others will be linearly interpolated. So you want to select house numbers that will minimise the average interpolation error, given how many house locations you have capacity to store. We view the street as a straight line, and you will always store the first and the last house location. Given that you ve stored the locations x i and x j for the houses with numbers i and j respectively, but no other house in between, the interpolated value for a house with number k with i<k<jis x i +(x j x i ) k i. j i The first line of input gives a single integer, 1 t 50, the number of test cases. For each test case, there are two lines. The first contains 2 h 200 and 2 c h, where h is the number of houses in the street and c is the number of house locations that can be stored. The second contains h integers in increasing order giving the location of the h houses. Each location is in the interval [0, 1000000]. For each test case, output the average interpolation error over all the h houses for the optimal selection of c house locations to store. The output should be given with four decimal places, but we will accept inaccuracies of up to ±0.001. Sample input 2 4 3 0 9 20 40 10 4 0 10 19 30 40 90 140 190 202 210 Output for sample input 0.2500 0.3000