Timeline for CSES standard solution for range query problem giving TLE
Current License: CC BY-SA 4.0
21 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 26, 2020 at 17:45 | history | edited | hjpotter92 | CC BY-SA 4.0 | deleted 491 characters in body |
| Oct 26, 2020 at 17:44 | comment | added | hjpotter92 | @HeapOverflow that is what i was thinking when i put in that edit above. hadn't tested with the same though. will remove the entire section now. | |
| Oct 26, 2020 at 17:42 | comment | added | Kelly Bundy | I think so, too. But how is that relevant? | |
| Oct 26, 2020 at 17:38 | comment | added | hjpotter92 | @HeapOverflow I think the automated evaluators do use stdin redirection pipes to feed input data (dockerised run of code). | |
| Oct 26, 2020 at 17:05 | comment | added | Kelly Bundy | I see your edit. It has nothing to do with being piped. It's solely about whether there's an empty line. If what you pipe in has an empty line, that works. If you enter manually and end the input (probably you can do that by pressing ctrl-d) without an empty line, then you get the error. | |
| Oct 26, 2020 at 11:43 | history | edited | hjpotter92 | CC BY-SA 4.0 | added 316 characters in body |
| Oct 26, 2020 at 11:36 | comment | added | Kelly Bundy | @hjpotter92 You additionally entered an empty line, didn't you? That's not guaranteed to exist in the input, and in fact there isn't one. If you submit it with that way, you'll get that error. | |
| Oct 26, 2020 at 7:15 | comment | added | hjpotter92 | @HeapOverflow the first suggested implementation works for me: i.sstatic.net/jNg8X.png | |
| Oct 25, 2020 at 17:37 | comment | added | Kelly Bundy | @hjpotter92 That gives the same error. | |
| Oct 25, 2020 at 17:16 | comment | added | hjpotter92 | @HeapOverflow ah, you're correct. Although, as mentioned in reply above, with a while loop while True: line = input(); if not input: break | |
| Oct 25, 2020 at 17:07 | comment | added | Kelly Bundy | @hjpotter92 But how do you handle the EOFError: EOF when reading a line caused by that? | |
| Oct 25, 2020 at 16:18 | comment | added | hjpotter92 | @HeapOverflow while line := input(): | |
| Oct 25, 2020 at 14:08 | comment | added | Kelly Bundy | How would that "breaks on empty input" look like, exactly? | |
| Oct 23, 2020 at 14:39 | comment | added | YetAnotherBot | @Reinderien I will do performance evaluation and comment further | |
| Oct 23, 2020 at 14:38 | comment | added | YetAnotherBot | Thanks for the recommendation @hjpotter92. I'll do performance check when I get some free cycles. Will get back to you guys shortly. | |
| Oct 23, 2020 at 13:52 | comment | added | Reinderien | I disagree with the move to map. I think the OP's input method is fine, though he should be using a generator and not a list for those lines. The generator is much clearer to read. | |
| Oct 23, 2020 at 11:35 | comment | added | hjpotter92 | You can do a performance check to get which operation is consuming the most time. Most likely cause could be the .append operation @AdityaGupta | |
| Oct 23, 2020 at 5:12 | comment | added | YetAnotherBot | Update: I've added stdout for outputting and converting the same array in place to cumulative sum. Still TLE. | |
| Oct 23, 2020 at 5:01 | comment | added | YetAnotherBot | Additionally, I used stdin to speed up reading. But that didn't help either. | |
| Oct 23, 2020 at 4:55 | comment | added | YetAnotherBot | Thank you so much for all the recommendations. Unfortunately, it's still giving TLE. The reason I suspect split to be time-consuming is the fact that initially a string is read and split into n elements. Other languages like java/C++ have an option to read individual numbers directly. | |
| Oct 23, 2020 at 4:47 | history | answered | hjpotter92 | CC BY-SA 4.0 |