KTH Challenge 2013. Solutions. Further Information KTH Challenge 2013. April 21, 2013



Similar documents
NCPC 2013 Presentation of solutions

EE602 Algorithms GEOMETRIC INTERSECTION CHAPTER 27

Social Media Mining. Graph Essentials

Load balancing Static Load Balancing

Load Balancing and Termination Detection

Topological Properties

13. Write the decimal approximation of 9,000,001 9,000,000, rounded to three significant

Krishna Institute of Engineering & Technology, Ghaziabad Department of Computer Application MCA-213 : DATA STRUCTURES USING C

Load Balancing. Load Balancing 1 / 24

Solutions to Homework 6

Algorithms and Data Structures

5. A full binary tree with n leaves contains [A] n nodes. [B] log n 2 nodes. [C] 2n 1 nodes. [D] n 2 nodes.

APP INVENTOR. Test Review

root node level: internal node edge leaf node Data Structures & Algorithms McQuain

Load Balancing and Termination Detection

International Journal of Software and Web Sciences (IJSWS)

Data Structures. Level 6 C Module Descriptor

Exponential time algorithms for graph coloring

6 March Array Implementation of Binary Trees

Load Balancing and Termination Detection

Finding and counting given length cycles

Lecture 10: Regression Trees

Full and Complete Binary Trees

The Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge,

Euclidean Minimum Spanning Trees Based on Well Separated Pair Decompositions Chaojun Li. Advised by: Dave Mount. May 22, 2014

MEMORY WORK - MATH FACTS 1

Static Load Balancing

Previous Lectures. B-Trees. External storage. Two types of memory. B-trees. Main principles

Binary Heaps * * * * * * * / / \ / \ / \ / \ / \ * * * * * * * * * * * / / \ / \ / / \ / \ * * * * * * * * * *

Sample Questions Csci 1112 A. Bellaachia

Are You Ready for College? Take this Quiz and Find Out

Fast nondeterministic recognition of context-free languages using two queues

Building Alternate Multicasting Trees in MPLS Networks

Binary Heap Algorithms

8.1 Min Degree Spanning Tree

Sorting revisited. Build the binary search tree: O(n^2) Traverse the binary tree: O(n) Total: O(n^2) + O(n) = O(n^2)

VISUAL ALGEBRA FOR COLLEGE STUDENTS. Laurie J. Burton Western Oregon University

Binary Heaps. CSE 373 Data Structures

Lecture 2 February 12, 2003

CSC2420 Fall 2012: Algorithm Design, Analysis and Theory

Crosskart NEZ Championship Competition regulations 2015

Data Structure [Question Bank]

Network (Tree) Topology Inference Based on Prüfer Sequence

Chapter 7 Load Balancing and Termination Detection

Sport Timetabling. Outline DM87 SCHEDULING, TIMETABLING AND ROUTING. Outline. Lecture Problem Definitions

Outline BST Operations Worst case Average case Balancing AVL Red-black B-trees. Binary Search Trees. Lecturer: Georgy Gimel farb

6.3 Conditional Probability and Independence

CSE 326, Data Structures. Sample Final Exam. Problem Max Points Score 1 14 (2x7) 2 18 (3x6) Total 92.

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

Big Data and Scripting. Part 4: Memory Hierarchies

Big O and Limits Abstract Data Types Data Structure Grand Tour.

Binary Search Trees. A Generic Tree. Binary Trees. Nodes in a binary search tree ( B-S-T) are of the form. P parent. Key. Satellite data L R

Why Use Binary Trees?

A binary search tree is a binary tree with a special property called the BST-property, which is given as follows:

Fish Chomp. Level. Activity Checklist Follow these INSTRUCTIONS one by one. Test Your Project Click on the green flag to TEST your code

Approximation Algorithms

A binary heap is a complete binary tree, where each node has a higher priority than its children. This is called heap-order property

Chapter 6: Graph Theory

Analysis of Algorithms, I

Data Mining on Streams

CompSci-61B, Data Structures Final Exam

Introduction to Data Structures

1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++

B-Trees. Algorithms and data structures for external memory as opposed to the main memory B-Trees. B -trees

SQUARE-SQUARE ROOT AND CUBE-CUBE ROOT

A LEVEL H446 COMPUTER SCIENCE. Code Challenges (1 20) August 2015

INTRODUCING THE RULES OF THE GAME

Binary Trees and Huffman Encoding Binary Search Trees

Triangulation by Ear Clipping

IE 680 Special Topics in Production Systems: Networks, Routing and Logistics*

OPTIMAL BINARY SEARCH TREES

Home Page. Data Structures. Title Page. Page 1 of 24. Go Back. Full Screen. Close. Quit

Mechanical Reasoning Test

The Quality of Internet Service: AT&T s Global IP Network Performance Measurements

Introduction Solvability Rules Computer Solution Implementation. Connect Four. March 9, Connect Four

CHAPTER 4 ESSENTIAL DATA STRUCTRURES

2. (a) Explain the strassen s matrix multiplication. (b) Write deletion algorithm, of Binary search tree. [8+8]

Chapter 7: Termination Detection

Random Map Generator v1.0 User s Guide

CAHSEE Algebra Cluster #4: Statistics, Data Analysis, an Probability Name: Cluster #4 Review

Three-dimensional figure showing the operation of the CRT. The dotted line shows the path traversed by an example electron.

DATABASE DESIGN - 1DL400

Activities with Paper How To Make and Test a Paper Airplane

Binary Search Trees 3/20/14

Chapter 15: Dynamic Programming

An Introduction to The A* Algorithm

GREEN CHICKEN EXAM - NOVEMBER 2012

Outline. NP-completeness. When is a problem easy? When is a problem hard? Today. Euler Circuits

This exam contains 13 pages (including this cover page) and 18 questions. Check to see if any pages are missing.

Partitioning and Divide and Conquer Strategies

Introduction to Algorithms. Part 3: P, NP Hard Problems

From Last Time: Remove (Delete) Operation

Graph Mining and Social Network Analysis

Ordered Lists and Binary Trees

Any two nodes which are connected by an edge in a graph are called adjacent node.

CSE 326: Data Structures B-Trees and B+ Trees

Rocco s Proven Phone Script. Hello. Hi. This is representing. I m assigned to the area and my company asked kdme to give you a call.

Transcription:

April 21,

Jury Lukáš Poláček (, Spotify), head of jury Per Austrin () Oskar Werkelin Ahlin (Spotify) Ulf Lundström () Marc Vinyals () Erik Aas () Emma Enström () Andreas Lundblad ()

B Peragrams Only one letter can have odd number of occurrences in a palindrome. We need to remove o 1 letters, where o is the number of letters with odd number of occurrences. Don t print 1! Problem author: Oskar Werkelin Ahlin Statistics: 89 submissions, 51 correct, first at 0:04:10. Photo by Ross Beresford

F Bank Queue Create T time slots for T minutes. Put each person into their time slot. Process times slots from T 1 to 0 and add all the people to the set of candidates. At each time slot pick the person with the most money which hasn t been picked yet. Need fast data structure to get O(N log N) time. Problem author: Lukáš Poláček Statistics: 93 submissions, 33 correct, first at 0:09:07.

A Car Game Keep track of the first word for each possible licence plate (there are only 17 576 of them). For each word, list all license plates that fit. Go through the word keeping a list of letters you have seen. Use this to also keep a list of ordered pairs of letters. Each such pair combined with a new letter gives a possible license plate. Problem author: Ulf Lundström Statistics: 135 submissions, 29 correct, first at 0:26:34.

I Flag Quiz Calculate d(i, j), the distance between answer i and j. For each answer calculate the incongruousity the maximum distance to other answers. Print all answers with the smallest maximum distance (incongruousity). Problem authors: Ulf Lundström and Emma Enström Statistics: 57 submissions, 23 correct, first at 1:10:43.

C Vacuum Tubes Sort tubes: l1 ll. For each tube i, find an index pi such that li + lpi L1 and pi is as large as possible. Find similar index qi for L2. Try all i, j {1,..., N}. Try pairing i with pi, pi 1, pi 2, pi 3 and j with qi, qi 1, qi 2, qi 3. Make sure we don t use a tube twice. Also possible in O(N log N). Problem author: Ulf Lundstro m Statistics: 47 submissions, 13 correct, first at 0:37:14.

D Chicken Joggers Traverse the tree by depth-first-search, keep track of the distance from the root. If we can t visit any Photo by David Spencer more intersections after visiting intersection u (leaf), we can decide if we need to put a lamp here. If u is not a leaf, we can decide whether we need a lamp by looking at already processed sons and edges going away from the root. Problem author: Oskar Werkelin Ahlin Statistics: 39 submissions, 7 correct, first at 0:44:26.

H Free Cell We can move twice as many cards using M + 1 empty stacks than using only M. We can move N + 1 cards using 0 empty stacks and N free cells. Hence we can move at most (N + 1) 2 M cards. Slower solutions also worked. Problem author: Andreas Lundblad Statistics: 18 submissions,?? correct, first at 1:42:57.

Forest (2/2) Rotation is easy using complex numbers. Problem author: Lukáš Poláček Statistics: 5 submissions,?? correct, first at??.

E Hogwarts (1/2) Use black color for an existing edge, white color for missing edge. Photo by erinjudge It s possible to rotate colors on a cycle u, v, w or a path of length 3 u, v, w, x. Process edges in lexicographic order (0, 1),..., (0, N 1), (1, 2),..., (N 2, N 1): Try to fix color of (i, j) by rotating a cycle i, j, k, such that i < j < k. Otherwise try a path i, j, k, l, such that i < k < l. We never change an edge that was already processed.

E Hogwarts (2/2) In the end we might not be able to fix the last node repeat the same process backwards. If this didn t succeed, randomly change labels from i to (i + c) mod N and try again. This works for big graphs, for small graphs use brute force. Problem author: Erik Aas Statistics: 17 submissions,?? correct, first at??.

This was fun! When is the next contest? We train every two weeks at, check www.csc.kth.se/contest. Next training on Wednesday at 17:15 in Orange. Nordic Championships in October, North-western Europe qualifier in November. Plenty of other online competitions every week. Subscribe to our calendar and RSS feed.

Boot camp June 7 June 9 3 days on Möja in the archipelago. Lectures, trainings and fun activities. By invitation only. Also camp for Swedish IOI team and Linköping University. Photo by The U.S. Army

Guide To Programming Contests http://contest-wiki.csc.kth.se/ Written by Lukáš. Chapters How to get better? and Team strategy almost complete. More to come. The first training program for programming contests. Well received in the contest community.