METEORAK - Editorial

add link please :wink:

you used cout in C++ and printf in C which is much faster than cout …

1 Like

can anyone tell the complexity of my C sol link given above. Is it according to the editorial or not?

my pleasure to help you :smiley:

1 Like

wait, I see a totally different solution than what I read before… let me have a look

okay, you are right. thanks to the weak test cases and relax time limit.

Indeed, I am still waiting for Suraj to give me the links too…

similar algorithm to @ivan100sic?

1 Like

Hm? fropen is not commented in code with TLE you linked!

What is meant by “Suppose the matrix is…left and right are both exclusive” in the editorial and why left and right are similar. Plz clear me this that why are we using left, up, right.

I used the exact approach as above but getting NZEC error (java) pls help.
http://www.codechef.com/viewsolution/3253203

Why not use some of the accepted solutions and check it yourself? :slight_smile: The largest input file size is 6957085 bytes, so your test case is not included.

It is definitely no problem to handle such amount of data in C and C++ (based on the accepted solutions, even 10 times as big data would be probably feasible).

1 Like

As for Java, the best accepted solution has a total run time just below 2 s, which is the time limit for Java, so it’s definitely feasible as well.

Using my Core i7@2,2 GHz, I’m able to read your input and produce your output in about 0,5 s. SPOJ use Pentium G860@3 GHz. I don’t have this CPU, but its performance should be comparable in this case, so handling the I/O in under a second should be possible.

2 Likes

because we will enumerate the lower bound of the “extreme matrix”, and then, for given (i, j) and up[i][j], we would like to extend this vertical line to left and right as far as possible. Since the vertical height is fixed, “right[]” is similar to “left[]”. We can get “right[]” in a way similar to the way of getting “left[]”.

Similarly, we define d[l][r] as answer for corresponding query. The answer is max{c[i][j] * (j - i + 1), d[i][j - 1], d[i + 1][j]} (the bounary case is d[i][i-1] = 0). So, we should fill in the d[][] in order of increasing the length of interval j - i + 1, in similar way to that we get c[][].

Can somebody elaborate on this part … really unclear… what is i,j and how are we obtaining d[][] by using c[][] …

1 Like