We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- All Contests
- HourRank 23
- Largest Pyramid
- Discussions
Largest Pyramid
Largest Pyramid
Sort by
recency
|
13 Discussions
|
Please Login in order to post a comment
Hello guys , can i clear up my self when is the exams and can i get the details about this pls..?
Can someone answer me that when is the final test for it .?
I just wondering why do we need wierd stuff like this:
#define x1 fldgjdflgjhrthrl
It's from editorial...
The test data for this problem is very strong. Even my O(nmmin(n, m)) failed some tests. In the end I profiled my code and found the bottleneck is log2() in my Sparse table lookup. The value of log2(x) could be precalculated, or implemented with a tricky one(https://stackoverflow.com/a/11398748/4140668).
Vote for Difficulty:Hard due to its test data
How is the last test example possible? From the second example we conclude that i, j are 1-based:
s = 1, min(1, 1, 2*1 - 1, 2*1 - 1) = min(1, 1, 1, 1) = 1.
0-based won't work:
min(0, 0, 2*1 - 0, 2*1 - 0) = min(0, 0, 2, 2) = 2 =/= 1
So consider the last test example:
Let's check the bottom right corner (i = 6, j = 5).
s = 3, min(6, 5, 2*3 - 6, 2*3 - 5) = min(6, 5, 0, 1) = 0 =/= 1
I think no pyramid of size s should exists outside the square {i < 2s, j < 2s}, cause to make
min(i, j, 2s - i, 2s - j) > 0,
i, j should be less than 2s and the pyramid of size 1 is of height 1 as well.
Am I wrong?