Download 316_PA3 - COW

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Types of artificial neural networks wikipedia , lookup

Diff wikipedia , lookup

Nonblocking minimal spanning switch wikipedia , lookup

CAL Actor Language wikipedia , lookup

Transcript
CENG 316 Practice Of Algorithms
Fall 2012
Programming Assignment 3
___________________________________________________________________________
1. REGULATIONS
Due Date: 29th October 2012, Monday, 23:55
Submission: Use COW system to submit your homework file. You are expected to submit a
single C++ source file named “ios.cpp”.
Newsgroup: You must follow the newsgroup metu.ceng.course.316 for discussions and
possible updates on a daily basis.
2. SPECIFICATIONS
2.1 Problem Definition
In this assignment you are expected to design and implement an algorithm for the problem
Itersection of Skylines (IOS). IOS problem originates from the well-known Skyline
Problem. You may find a detailed explanation of the skyline problem in:
http://acm.uva.es/p/v1/105.html
IOS problem asks for the intersection of k skylines. To illustrate, the right figure below
represents the intersection of the two skylines in the left figure.
Skylines are represented in vector format as (v1 , v2, ..., vn).


If the index i of the number vi is even, it represents a a horizontal line (height).
If the index i of the number vi is odd, it represents a vertical line (x-coordinate).

The skyline vector should represent the ``path'' taken, for example, by a bug starting at
the minimum x-coordinate and traveling horizontally and vertically over all the lines
that define the skyline.
The vector representation of the red skyline in the figure is
(2, 3, 7, 9, 9)
The vector representation of the black skyline in the figure is
(4, 5, 6, 7, 10)
2.2 Input Output Specifications

Your program is expected to find the intersection of the k skylines provided in the
input file. Your program should read input from the “input.txt” in the same folder.

First line of the input file specifies the number of input skylines k. Following lines are
the input skyline vectors from s1 to sk.
<k>
<s1>
<s2>
…
…
<sk>

Your program is expected to output the skyline vector to standart output.

Your program should read and print skyline vectors (v1,v2,v3...,vn) as
v1 v2 v3 .....vn
The vi s are separated by whitespace characters.

To sum up, the input and output of your program for the case in figure should be as
given:
Input File
2
2 3 7 9 9
4 5 6 7 10
Output
4 3 7 7 9
2.3 Limits and Evaluation
Your solutions will be evaluated with test cases k<=1000 and n <=1000.