| Show all threads Hide all threads Show all messages Hide all messages |
| - | 💮meanlessnessener`~ | 2045. Richness of words | 14 Apr 2024 20:01 | 1 |
- 💮meanlessnessener`~ 14 Apr 2024 20:01 Edited by author 14.04.2024 21:19 |
| Help!!!! | IntoTheDusk | 1394. Ships. Version 2 | 12 Apr 2024 01:08 | 2 |
When I tried the brute force algorithm, I TLE at #15 How to solve this problem? Please send the solution to 13588731339@163.com 1) When bruteforcing, random shuffle both m rows and n ships 2) When solving one subset sum problem inside bruteforcing, use bitset (array of bitsets) instead of bool array (2d-array). Instead of max() in subset sum problem, use operator OR and operator "right bit shift". Just search "subset sum problem bitset" and you'll find out. This will speed up your dynamic programming in 32 or 64 times (if you are using both 64-bit compiler and 64-bit processor) It will not totally solve problem, but you will get TLE#67 which is better and giving more hope :) Edited by author 12.04.2024 01:08 Edited by author 12.04.2024 01:09 Edited by author 12.04.2024 01:11 |
| Brute Force | pocochuk | 1769. Old Ural Legend | 11 Apr 2024 03:49 | 1 |
|
| Did anyone solved this using rolling hash and unordered_map (HashMap)? | prituladima | 1706. Cipher Message 2 | 9 Apr 2024 12:02 | 1 |
I tried this approach with Java: Test 5. TL With C++: Test 9. TL And seems like this is not enough, however time complexity is O(αk^2 + α|S|*k) where α is hash map hidden constant. So... did anyone managed to solve it this way? |
| i solved dp[i] - the number of sequences of length i | hakka_no_togame | 1081. Binary Lexicographic Sequence | 6 Apr 2024 22:41 | 3 |
dp[i][j] - amount of i-digit numbers ending with j. therefore we form 2d table dp[n][2] then dp[i][0] = dp[i - 1][0] + dp[i - 1][1] dp[i][1] = dp[i - 1][1] It's not hard to see that dp[i][0] + dp[i][1] (i.e. number of all valid sequences) forms a fibonacci sequence. dp[i][0] + dp[i][1] = 2*dp[i - 1][0] + dp[i - 1][1] you can treat as f_n = 2*f_(n - 2) + f_(n - 3) But still, I don't know how to solve this problem :) Edited by author 23.01.2022 01:36 Edited by author 23.01.2022 01:37 dp[i][1] = dp[i - 1][1] is wrong, should be: dp[i][1] = dp[i - 1][0] |
| Hint - Illustration | Daniil | 1893. A380 | 3 Apr 2024 19:41 | 2 |
( window | A | aisle |B C| aisle | D | window )-- Premium (1-2) ( window | A B| aisle |C D| aisle |E F | window )-- Business (3-20) ( window | A B C| aisle |D E F G| aisle |H G K | window )-- Economy (21-64) Edited by author 30.05.2022 16:38 |
| Slight Clarification | SquidBoy | 2056. Scholarship | 1 Apr 2024 13:02 | 3 |
It took me a while to get this one correct, and it's because I found part of the descritpion to be ambiguous/unclear - so I'm posting this clarification which hopefully will help anyone else who has the same misunderstanding. "if a student has got satisfactory marks, the scholarship is not given, " I read this to mean "got ONLY satisfactory marks" but my solutions were rejected. Once I modified my solution to treat it as "got ANY satisfactory marks", the solution was accepted. |
| Check this test case to avoid WA #4 | Newaz | 1581. Teamwork | 1 Apr 2024 11:04 | 1 |
First time I've got WA #4 because of this test case: Input: 6 1 1 2 1 1 1 Correct answer: 2 1 1 2 3 1 |
| Solution idea in C++ | Newaz | 1585. Penguins | 1 Apr 2024 10:04 | 1 |
Instead of using getline(cin, str), use two different string such as string s1, s2. Then compare s1! |
| Wrong test cases | pocochuk | 1984. Dummy Guy | 29 Mar 2024 08:40 | 1 |
When n > 6 the cases are wrong. Try to do it without placing a circle in the center. |
| Test 42 | BENDER | 1014. Product of Digits | 29 Mar 2024 02:32 | 2 |
How is it POSSIBLE to find 42 test case? It seems like everything should work fine.. OK, found my mistake. 777&222 would be very helpful test cases) |
| solved | Jakub Minarik | 1000. A+B Problem | 28 Mar 2024 16:13 | 1 |
solved Jakub Minarik 28 Mar 2024 16:13 already done. for someone who doesn't know how to do it: a,b = input().split() print(int(a)+int(b)) a = int(1) b = int(5) Edited by author 28.03.2024 16:23 |
| Is the segment close or open? | Ade | 1469. No Smoking! | 28 Mar 2024 08:06 | 2 |
What the output of? 2 0 0 1 1 1 1 2 2 |
| WA in 11 test help please | Nabi | 1469. No Smoking! | 28 Mar 2024 08:03 | 2 |
i used redblack tree on python and using a quick input using stdin i passed test 8 time limit and met evening at 11 ok, it was a perpendicular but what about 15 test |
| Use cstdio | pocochuk | 1306. Sequence Median | 27 Mar 2024 05:35 | 1 |
|
| The most stupid solution | andreyDagger`~ | 1621. Definite Integral | 23 Mar 2024 21:40 | 1 |
Just run Simpson's method, you will only need to find suitable "a", "b" and "N" parameters, but it can be done easily with trial and error method |
| How to solve it without BigDecimal? | gerind | 1814. Continued Fraction | 22 Mar 2024 17:26 | 2 |
|
| Who can explain the right solution?(-) | Programmer | 1735. Theft of the Century | 22 Mar 2024 07:53 | 2 |
|
| WA5 Python | Shepeleva Elena | 1037. Memory Management | 21 Mar 2024 22:28 | 1 |
class MemoryManager: def __init__(self, n, t): self.n = n self.t = t self.blocks = {} self.free_blocks = set(range(1, n + 1)) def allocate_block(self, time): block = min(self.free_blocks) self.free_blocks.remove(block) self.blocks[block] = time + self.t return block def access_block(self, time, block_no): if block_no in self.blocks and self.blocks[block_no] >= time: return '+' else: return '-' n = 30000 t = 10 memory_manager = MemoryManager(n, t) queries = input().strip() for query in queries: query_type = query[0] time = query[1] if query_type == '+': print(memory_manager.allocate_block(time)) elif query_type == '.': block_no = query[2] print(memory_manager.access_block(time, block_no)) |
| Can anyone explain to me the input ? | Nguyen Khac Tung | 1878. Rubinchik's Cube | 17 Mar 2024 22:20 | 2 |
I don't understand how to translate them to the initial state . Tks This is 4 layered Rubics Cube. These layers are situated behind each other (perpendicularly). You can think them as 4 Cards placed behind each other. Also, each layer is transparent. So, color on the second, third or fourth layer can be seen through the first layer. Top View is watching the cube from the first layer. As all the layers are transparent, so we can see the colors of each layer behind it from the first layer. So, from the TOP VIEW you will see a complete cube combining each layer's colors. In the description, the first picture is the 4 layers of the cube. Can you place them behind each other? What will you see if you observe them from the first layer and considering them as transparent? If you see them like below, then bingo you get the idea!! YRYB RRYY GGBB RGBG Here, the first Y and the last B color of the first row are coming from the 4th layer if you see. And so on for the rests. In the given input, let say the color code is like below, 1 - Red 2 - Yellow 3 - Blue 4 - Green. So, the input basically says that what you will see all the layers from the front of the first layer. If you replaced the number with the color, then you will get the exact same cube that is given in the description. (We have already built it above!!) |