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 5
- Stacy numbers
- Discussions
Stacy numbers
Stacy numbers
Sort by
recency
|
11 Discussions
|
Please Login in order to post a comment
Can someone please explain the problem setter's solution ?
I tried using suffix arrays, still too slow. Any hints?
[lenth,que]=input().split(" "); lenth=int(lenth); que=int(que); num=input(); ans=[]; for i in range(0,lenth): if int(num[i])==0: ans.append(int(num[i])); continue; for j in range(i+1,lenth+1): ans.append(int(num[i]+num[i+1:j])); ans.sort(); for i in range(que): print((ans[int(input())-1])%(10**9+7));
Can you tell me what is wrong in the code? Test case 6 onwards this code is not working. It is failing due to time out.
Segmentations faults from test case 8 and 5,6,7 produce wrong answers . Possible deductions? Thanks.
The queries in test case 7 does not follow the constraint of 0<=qi<= 10^5.