| Show all threads Hide all threads Show all messages Hide all messages |
| I got it by precalc, but wanna know smart solution | Apkawa | 1150. Page Numbers | 10 Oct 2023 12:33 | 2 |
I precalculated digits for segment from 1e5 to 2e5, then i computed all digits from 1 to 1e5(if n >= 1e5), then i stepped from 1e5 to n with step size = 1e5. And after all this I computed digits from last step to n. It does about 1e9/1e5 steps and works 0.015 sec. I think that it's dumb solution, so I want to know, how to solve this task in O(log10(n)) or smth similar. Two ways I know - 1) Solve for each number of digits 2) Better way (hint): 1 to 10, 11 to 20, etc. each digit is counted once in the ones place Edited by author 10.10.2023 12:37 Edited by author 10.10.2023 12:37 |
| Why WA on test 6? | SpaceFlyer | 1439. Battle with You-Know-Who | 9 Oct 2023 13:54 | 6 |
I wrote two programs, one AC, one WA. I run these two programs for many times but they always make the same answer. Is it strange? Two test for you: ---Test 1--- 4 4 D 1 D 2 L 1 L 2 ---Test 2--- 4 4 D 2 D 1 L 1 L 2 Output 1: 2 4 Output 2: 3 4 Edited by author 01.04.2006 13:51 Thank you! Edited by author 05.08.2006 10:55 deleted Edited by author 13.12.2019 21:18 |
| Why Rintime Error!&!?!?!?! (python) | Dmitriy | 1800. Murphy's Law | 7 Oct 2023 21:16 | 1 |
a= input().split() l = int(a[0]) h = int(a[1]) ω = int(a[2]) g = 9.81 ω = ω * 2 * 3.14159 / 60 t = (h / 100) / (g * 0.5) x = ω * t * l if x % l <= l/2: print("butter") else: print("bread") |
| help (python) | quarylaniel | 1910. Titan Ruins: Hidden Entrance | 7 Oct 2023 11:31 | 2 |
why do I get runtime error? n = int(input()) for i in range (n) : a=list (map (int,input().split())) a.sort() c = a[::-1] d = c[0] + c[1] + c[2] e = (len(c) // 2) print(d, e) WA eremeev.me.2012@gmail.com 7 Oct 2023 11:31 EOF when reading a line 3 |
| Help me (Python) | ArtemNazarov | 1880. Psych Up's Eigenvalues | 7 Oct 2023 11:27 | 4 |
Time limit. Where is my mistake? cnt1 = int(input()) lst1 = input() lst1 = lst1.split() cnt2 = int(input()) lst2 = input() lst2 = lst2.split() cnt3 = int(input()) lst3 = input() lst3 = lst3.split() cnt = 0 for i in range(cnt1): for j in range(cnt2): if lst1[i] == lst2[j]: for k in range(cnt3): if lst1[i] == lst3[k]: cnt += 1 else: continue print(cnt) Edited by author 31.10.2017 14:42 Your code has O(cnt1 * cnt2 * cn3). If cnt1 is 4000, cnt2 is 4000, cnt3 is 4000, Your code will work (4000*4000*4000)/10^8 seconds. 640 seconds. 640 > 0.5 I agree 640>0.5 Edited by author 15.07.2018 02:43 Edited by author 15.07.2018 02:43 Ac eremeev.me.2012@gmail.com 7 Oct 2023 11:27 a = input() A = list(map(int , input().split())) a = input() B = list(map(int , input().split())) a = input() C = list(map(int , input().split())) print(len(set(A) & set(B) & set(C))) |
| Is it possible to get wrong answer because of rounding numbers? | roman velichkin | 2099. Space Invader | 6 Oct 2023 17:43 | 2 |
Vectors calculations uses square roots. Could this lead to not very precise floats and wrong results? Edited by author 05.10.2023 13:50 Edited by author 05.10.2023 13:50 In this sort of problems rounding errors could be the source of problems. That's why you shall avoid using float types here. The problem is completely solvable in integers. |
| help me Wa on test 8 | mj256 | 1116. Piecewise Constant Function | 6 Oct 2023 13:24 | 2 |
I just don't know what is wrong.I need some test in order to pass test 8 The test below helped me on WA#8. 2 5 6 -1 10 11 -1 2 -1 1 0 8 9 0 Right answer: 2 5 6 -1 10 11 -1. |
| WA5 | Gilles Deleuze | 2099. Space Invader | 5 Oct 2023 14:21 | 3 |
WA5 Gilles Deleuze 30 Jul 2018 23:38 Check that you indeed turn after reaching point B, i.e. that intersection point is not between A and B or you don't even reach B. Re: WA5 roman velichkin 5 Oct 2023 13:45 There is something else. My code checks turning before B but still got WA on #5. Re: WA5 roman velichkin 5 Oct 2023 14:21 Spaceship can go only forward, so check - there shouldn't be any backward movement. Test #5 is about that. Edited by author 05.10.2023 14:33 |
| help, i have a question on test 9.. | liuhy | 1162. Currency Exchange | 4 Oct 2023 18:35 | 6 |
it is said that the testcase 9 is as follow: 4 4 1 11.1 1 2 2.0 0.5 0.5 0.5 2 3 1.05 1 0.01 1.0 3 4 1.05 1 0.01 1.0 4 2 1.05 1 0.01 1.0 the right answer is YES. but i think there is no possibility to increase his money, so the answer should be NO. could someone explain this test case to me.? thanks a lot.. Edited by author 19.09.2010 18:45 Oh, such a ridiculous situation! Edited by author 19.09.2010 18:58 Edited by author 19.09.2010 18:58 i know it....something wrong with my brain. I'm the same with you…… it showed the ans as: NO ……………… 3 2 1 100.0 1 2 1.0 0.0 1.0 10000 2 3 1.1 0.0 1.1 0.0 |
| Clarification request | Semm | 1529. Game of Squares | 1 Oct 2023 23:53 | 1 |
At the beginning of the turn, does player choose only among the parallelepipeds generated during the last turn, or among all of them, including the previous turns? For example, K=1, n1=11 First player dissects it at x=2. We have now two parallelepipeds, of size 1 and 9. Second player chooses the one of size 9, and dissects it at x=3, generating parallelepipeds of size 2 and 6. Does first player have choice between 1, 2 and 6? Or only 2 and 6? |
| Great problem! | Denis Koshman | 1478. Spy Satellites | 1 Oct 2023 13:22 | 5 |
It became such when true claster analysis began or inner structure of each claster is forgotten and clasters are simple poins again. Some time I was tried to trace complicated inner structure but failed. is there simpler solution?? I use brute_force search.... Yes, O(n^3) solution (maybe can be optimized to O(n^2*log(n)) with nice tree merging) based on MST. Great problem!!! yes. love the problem. some tests: 5 0 0 0 1 0 2 0 4 0 5 5 0 0 0 1 0 3 0 4 0 5 0 |
| If you have problem with test #8 | Semm | 1240. Heroes of Might and Magic | 29 Sep 2023 17:42 | 1 |
Try this test: 10 100 50 10 10 10 99 1 1 1 1 1 1 1 1 1 1 |
| WA test5! Help, please! | Kate | 1119. Metro | 27 Sep 2023 14:02 | 5 |
Попробуй большую точность, там где большое поле, например: Input: 1000 1000 5 100 100 200 200 300 300 400 400 500 500 Output: 199707 Thanks it was rounding error |
| easy bfs | 👑TIMOFEY👑`~ | 1700. Awakening | 26 Sep 2023 21:27 | 2 |
|
| Is there a way to do this problem without large numbers? | mihai.alpha | 1818. Fair Fishermen | 26 Sep 2023 02:18 | 1 |
It's kinda tedious since you need most operations too |
| Weird optimizations required to AC the problem in Python. Need to increase ML to 128 Mb (-) | Vedernikoff 'Goryinyich' Sergey (HSE: АОП) | 2093. All Roads Lead to Snowdrift | 25 Sep 2023 01:12 | 2 |
Спасибо, будем знать Edited by author 25.09.2023 01:13 |
| If you can tell me the HINT<><>><<>><<><<< | test | 1006. Square Frames | 24 Sep 2023 13:51 | 2 |
tell me the hint, i want to solve this problem. Always extract squares that you know can be valid to extract at that point in time. Also, another hint, even if you extract a square, you could reuse its grid to extract other squares, and the characters under the extracted square's grid can be anything you want them to be. |
| For anyone struggling to read the input | mihai.alpha | 1006. Square Frames | 24 Sep 2023 02:16 | 1 |
First off in your text editor switch from utf8 to cp437 (for example I use vscode and there's a tab in the bottom left that I can click to change the encoding). Only then, go to another comment on this problem (template for msvs 2010) and copy-paste the table from there. |
| AC finally, but with an ugly solution | mihai.alpha | 2042. Nikita | 23 Sep 2023 17:23 | 1 |
For anyone struggling with this problem, here's how I did it: segment trees with lazy updates for the dp O(sqrtN) updates for the string itself (the logN retrieval with the segment trees instead of the O(1) with the sqrt blocks retrieval was too big of a hog it seems, maybe I messed something up) Manacher for the edge cases and dp[i] = dpEven[i] + dpOdd[i] from Manacher So I used the segment trees to do most of the work, and then for the edge cases I used Manacher, so on average I'd get O(sqrt(N) + log(N) + K) for updates and O(log(N) + K) for queries. Does anyone have a less ugly solution? My source code is aroung 15kb (although I used long names for clarity) and around 550 lines long. Also I've seen people's code run a lot faster, under a second (mine ran in 2.7 s) and I was wondering how they did it. Thanks! |
| AC. segment_tree with brute_force | Shen Yang | 2042. Nikita | 20 Sep 2023 20:49 | 3 |
I did it with sqrt(N) blocks, and got tl on 11 too |