Sei sulla pagina 1di 3

Round 1

Rules: 1. You must submit your codes in a single word file with your team name as file name. 2. Your input and output requirements must match the specified format. 3. You can use C, C++ or Java. Do specify the language you are using at the top of word file. 4. Last date for submission of Round 1 solutions would be Jan 25,2012.

Problem statements
P1:In IPL, any two cricket teams play with each other exactly once. In each match, the winner earns 2 points and the loser loses no point. There is no draw. At the end of the league, the winner is the team having the largest number of points. In case there are more than one team which has the largest number of points, these teams will be co-champions of the league.Now, the following problem has arisen: we would like to know if a specific team still has a chance of winning the league. Input The first line of the test case contains a number N (1 <= N <= 100), the number of teams in the league. The i-th line in the next N lines contains N numbers ai1, ai2, ..., ain. The number aij gives the status of the match between the i-th team and the j-th team: aij = 1 if the i-th team wins, aij = 0 if the i-th team loses, aij = 2 if the match has not taken place yet. The input data is such that if i!=j, then aij + aji = 1 or aij = aji = 2. Moreover, aii = 0 for all i.

Output For a test case, print a binary string of length N, in which the i-th character is 1 if the i-th team still has a chance to be a champion of the league, and 0 otherwise. Example Input #1 4 0110 0020 0200 1110 Output #1 0001

P2:Write a program that takes two numbers N and M as input and find the number of shortest distance paths from lower left corner to upper right corner in an N*M grid. Please note that traversal is along the edges and a set of minimum number of edges traversed while reaching to the destination will comprise of one path. Example Input: 2 2 Output: 6

P3:-

Michael Jackson Marg was a dead end street. The houses on this Street were bought by rich. They had them extensively altered so that as one progressed along the street, the height of the buildings increased rapidly. However, not all rich were created equal. Some refused to follow this trend and kept their houses at their original heights. The resulting progression of heights was thus disturbed. A contest to locate the most ordered street was announced by the Municipal Corporation. The criteria for the most ordered street was set as follows: If there exists a house with a lower height later in the street than the house under consideration, then the pair (current house, later house) counts as 1 point towards the disorderliness index of the street. It is not necessary that the later house be adjacent to the current house. Note: No two houses on a street will be of the same height. For example, for the input: 124526 The pairs (4,2), (5,2) form disordered pairs. Thus the disorderliness index of this array is 2. As the criteria for determining the disorderliness is complex, the MC has requested your help to automate the process. You need to write an efficient program that calculates the disorderliness index of a street.

Input
Line 1: N , The size of the array. 1 <= N <= 10^2

Line 2: N integers denoting the heights of the various buildings in order of their locations on the street.

Output
Line 1: The disorderliness index of the street.

Example
Input: 6 124536 Output: 2

Potrebbero piacerti anche