Sort 466 Discussions, By:
Please Login in order to post a comment
The video pretty much told me how to solve this problem, which kind of defeats the purpose of the problem. I probably could have come up with something like it by myself, and doing so would have been a learning experience rather than an act of copy-and-paste. If it were in the discussion section, it wouldn't be so bad, but on the problem page, it was a major spoiler.
Terminated due to timeout test case 1.
I looked at that test case and it is quite big so it is talking more time and ultimately terminated.
Hi. I submitted a solution in Scala and Test0 is failing. I purchased the input and output for Test0 and I can see negative numbers on the test output. I checked the code and I don't see how it could be printing negative numbers. I also tried Test0's input as the custom input on the problem editor and it works well. Any clue of what could be happening? Thanks!
for _ in range(int(input())):
_, arr = input(), [int(n) for n in input().split()]
h = m = t = arr
for ind, n in enumerate(arr):
if ind == 0: continue
t = max(t, n, t + n)
h = max(n, h + n)
m = max(m, h)
Doesn't an array which size is 0 (empty) considered subarray? In first testcase, (maybe) intended solution doesn't considered a empty array is a valid subarray.
IMHO, these consideration should be declared in the problem statement.