|
|
Общий форумuse the formula sqrt(abs(x1 - x2)**2 + abs(y1 - y2)**2) not abs(x1 - x2) + abs(y1 - y2) Please give me some tests! (Please forgive me for my poor English.) First,use Hash to record ai Then,enumerate i,j as the first and the second items in the arithmetic sequence.check if 2*a[i]-a[j] exists.If it exists,we stop it immediately because the arithmetic sequence has been found.Otherwise,we find the arithmetic as brute force and mark the longest arithmetic sequence. At last,it's easy to restore the arithmetic sequence. So we can solve it in O(n^2). Edited by author 20.08.2021 13:43 Give some tests, please I hope, the following will help. I've found it using a random generator and a brute force checker. 7 2 -5 -4 -1 -1 -5 5 Answer: 13 In this problem, all the operations should be done on the SAME computer, but I could NOT understand this from the statement, until I read the forum. This problem is quite easy: simple bruteforce could AC in short time, but I think this bug in statement have made this problem SEEMS hard (only 100+ ACed now). Please, fix it. I think you can do on every computers.But doing on the same computer is the best solution. Maybe. Sorry my bad English.:) Damn, i used min(xa, xb) <= x_h <= max(xa, xb) and got WA5, then I wrote min(xa, xb) <= x_h && x_h <= max(xa, xb) and got AC Similar to page scheduling. Used two sets to simulate the process. :) Getting WA #9. My solution is bruteforce after dividing the lines give me some tests thanks. INPUT 1 2 1 0 1 1 0 1 0 OUTPUT 0 is correct? My AC program says 0 is correct!) The problem can be solved using brute force solution Make difference array, where dif[i] = i - a[i] Try 7 10 1 2 1 3 1 4 5 6 5 7 8 9 8 10 8 11 12 13 12 14 This test changed my solution totally. Hope it helps you:) Can the mouse go under the furniture? I mean, can it's way cross the polygons? I didn't solve it. But I think mouse CAN'T cross the polygon. If i think that mouse can go under furniture get WA3. If can't, get WA10 at the moment. So probably mouse can't go under furniture. I think it can't. I got WA3 if it can go under the furniture. But I got AC if it can't. Sorry,my English is very bad. Actually, you can solve it as a graph problem, where numbers 0, 1, ..., n are vertices, which connected like: 0-1, 1-2, ... I was able to solve it just by computing matrix determinant. Nothing to do with graphs, just taking advantage of matrix sparsity. WA #3: 1 1 -> 2 WA #5: 2 1 -> 3 WA #7: 5 3 -> 29 WA #8: 6 5 -> 63 WA #9: 5 1 -> 13 This is the case of a particularly small competition! If the starting point A is a station but you go by feet, is the station a visited station. For example, what is the solution for the following: 100 101 3 0 0 0 10 1 0 1 2 2 3 0 0 0 0 1 0 If you have TL on test 21, 49 or 50 you should use gets. I get AC with 0.3 s. I was getting TL21, but once I've added "ios_base::sync_with_stdio(false)", I got AC |
|
|