×

# FEB16 Long : SEATL

 0 Complexity : O(Number of Distinct elements in matrix * N) Concepts : Maps , sets . While a lot of people might have used O(NM*(N+M)) approach and recieved TLE even for subtask 1. The number of test cases are not specified for each subtask. Now instead of generating the count matrix , that is the maximum count of each element in that row+coloumn, we would rather do it number by number.Its given that the numbers are between 1 to 10^6 or we can say the maximum number of distinct elements in the matrix can be atmost N*M , We will have map data structure to store the coordinates of each element in the matrix. And from this we can find the length of the largest cross,and then print maximum length of cross of all elements. Here is my working code in python : Solution asked 15 Feb '16, 17:41 439●14 accept rate: 16% 0★admin ♦♦ 19.7k●350●498●541
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×1,312

question asked: 15 Feb '16, 17:41

question was seen: 1,034 times

last updated: 29 Feb '16, 15:21