| Show all threads Hide all threads Show all messages Hide all messages |
| 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 | die_young | 2099. Space Invader | 5 Oct 2023 14:21 | 3 |
WA5 die_young 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 |
| That's crazy | andreyDagger`~ | 1775. Space Bowling | 28 Sep 2023 00:35 | 1 |
#pragma GCC optimize("Ofast") With this line of code I'm getting AC 0.468, without it I'm getting TL14 |
| 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<><>><<>><<><<< | Levan Kasradze (GEO) | 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 |
| How it can be solved with disjoint sets??? | Enigma [UB of TUIT] | 1003. Parity | 19 Sep 2023 21:37 | 3 |
How it can be solved with disjoint sets? Anybody help me please. This is my mail: quvondiq.otajonov.tuit@gmail.com. I'll wait for answer! Thanks for advance!!! I know it's an old thread, but it's how I solved it. So spoilers and all. if l->r is even, then s[r] and s[l - 1] have the same parity (where s[x] is the partial sum of bits from 1 to x) if l->r is odd, then they have opposite parities We add l-1 and r to a dsu. So a dsu is just a tree of all dependencies, no matter if odd or even (see how I differentiate between the two below). I used dsu with an added property that is only available for dsu roots: sons[root][0] is the "representative" of all elements that have the same parity of root, sons[root][1] is the "representative" of all elements that have opposite parity of root. Anything else besides the root->representative edges will only have 0s, codifying that entire subtrees have the same parity. So first off when you do find, I haven't really bothered with path compression. And instead of just saying what is the dsu root for a node, you also say which side it came from (0 if it came from sons[root][0] and 1 for sons[root][1]) - so (0, root) means it has the same parity as root and (1, root) means it has opposite parities. So now when you do union, you first have a small case, if the two nodes are already in a tree, you have to verify that the sides they're on match the parity of s[r] - s[l - 1] otherwise you stop at the current test. Now, if they're not yet united, you have 4 cases that are basically just 2: if l-1 and r are on the same side of their respective dsus with s[r]-s[l-1] even, then this is one case if l-1 and r are on opposite sides of their respective dsus with s[r]-s[l-1] odd, then this is one case(identical with the previous one) And of course you have the opposite cases as well, which form another case you have to treat separately. So now you just have to move the left and right sides from one tree to the other so that they all match up correctly. You can do this however you like, just make sure that the property we've added to the dsu (sons is a unique property of the root of a dsu) is kept. Here's how I did it (let's treat just the case where l->r is even and l-1 and r are on the 0 sides of their respective dsus), and let's say l - 1 has root T1 and r root T2, we want to join the tree T2 into tree T1. T1 T2 0/ \1 0/ \1 a b c d | | | | A B C D (l - 1 comes from A, r comes from C) a, b, c, d are representatives of A, B, C, D. And this is how the finalized tree will Look:
T1 0/ \1 T2 d 0|\0 |\ a c D b | | | A C B As you can see, since T2 is no longer a root, sons[T2] becomes redundant since it's gonna have 0's on the edges which is what keeps the property. For the opposite case, you do something similar, just that T2 will be on the 1 side of T1 and you play around with the representatives. Of course there are some cases where some roots don't yet have both/any sons, but it's not too ugly to deal with them. Also for implementation, I normalized values but I think you could just use unordered_map/map. |
| How would you use a heap to solve this problem? | mihai.alpha | 1403. Courier | 19 Sep 2023 15:42 | 1 |
I've solved this problem using set (so a bst). I've thought of a method of using a segment tree. How would you come about using a heap, I'm curious? |
| Some weird optimizations required to get AC in Python, it makes sense to increase timelimit to 2-3 sec (-) | Vedernikoff 'Goryinyich' Sergey (HSE: АОП) | 2092. Bolero | 19 Sep 2023 03:19 | 1 |
|
| To Admin: Please update problem statement | Mickkie | 2158. Two progressions | 15 Sep 2023 00:50 | 2 |
It's ambiguous to me at least whether you can change the order of the sequence or not. like {a3, a1, a5, a7}, {a6, a2, a4, a8} Read the problem again. Set is given. so ordering is not taken into account. However WA34 now :( |
| help (python) | quarylaniel | 2100. Wedding Dinner | 10 Sep 2023 19:31 | 2 |
n = int (input()) cnt = 0 for i in range (n+1) : a = input() if a[-4:] != "+one" : cnt += 1 if a[-4:] == "+one" : cnt += 2 if cnt != 11 : print ((cnt * 100) + 200) if cnt == 13 : print ((cnt * 100) + 300) Runtime error,what's wrong? Edited by author 02.03.2022 22:29 |