|
|
My solution is O(n) (<=60 * n iterations) but I have TL on python Help me to read fast data input My input code: n, l, r = map(int, input().split()) tokens = sys.stdin.read().split() a = list(map(int, tokens)) Thx But I solved problem using C++. The same algo but new implementation (added if ((prod / (double)1000000000) * a[j-1]> 1000000000) j = 0; else prod *= a[j-1];) Edited by author 07.08.2019 13:55 Even though it took me almost 2 hours to solve I'm surprised this has difficulty of 1539. It doesn't require any special knowledge and almost anyone can solve this. Solution is pretty straightforward. |
|
|