Общий форумWhen n > 6 the cases are wrong. Try to do it without placing a circle in the center. 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) 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 What the output of? 2 0 0 1 1 1 1 2 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 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 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)) 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!!) I haven't coded my idea yet, but it looks plausible. We can use the idea of binsearch by answer. For a fixed cost x, we need to check that all intersection points are inside a square with center (0;0) and side length x*sqrt(2), rotated at an angle of 45 degrees. That is, there are no points of intersection of lines outside the square. Let us cut out the area of intersection with the square for each straight line, then each straight line will be divided into no more than two parts. Then we apply the idea of solving problem 1469. And the complexity will be O(log(max_answer)*n*log(n)). first make a SCC , u will get max iterate through scc graph root nodes and in dfs the node size is great than 2 increment answer u will get min is great than 2 no, great than 1! I got AC using it 150 : 556 Edited by author 14.06.2020 17:05 There is another interesting test case that might be a cause of WA8. Try 12, and the right answer should be 26. Edited by author 15.03.2024 16:13 Hi. Any ideas what they put inside the test file to #3? 4 d cd bcd abcd 1 eabcde 1 2 Thanks, found a bug :) У меня этот тест проходит :(, но WA 3... Может кто-нибудь помочь с тестом? I have passed your test,but I still WA#3.Why? Read badwords with spaces, so: 'this is badword' not: this is badword :) changes nothing, still wrong answer Could be space trimming of right side or left side a problem... Hi. Any ideas what they put inside the test file to #3? got WA on 3, why, have any tests? Edited by author 14.03.2024 17:39 Use dp + bitmask. I got AC in 0.015 and 1M Edited by author 14.03.2024 00:30 #include <iostream> using namespace std; int main() { double n, k1, k2, k3, pos = 2, current_pos = 2, oldsum = 0; cin >> n; cin >> k1 >> k2; while (cin >> k3) { double sum = k1 + k2 + k3; if (sum > oldsum) { oldsum = sum; pos = current_pos; } k1 = k2; k2 = k3; ++current_pos; } cout << oldsum << " " << pos; return 0; } |
|