|
|
Общий форум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 3 4 0 2000 1000 3000 0 3000 0 0 3000 0 3000 3000 0 3000 ans: 647.1067811865
5 6 0 2000 500 2500 1000 3000 1500 3000 0 3000 0 0 1500 0 3000 0 1500 0 3000 3000 0 3000 ans: 647.1067811865 3 4 0 0 4000 0 2000 4000 0 0 4000 0 4000 4000 0 4000 ans: 3517.7087639997 4 4 0 0 3000 0 3000 3000 0 3000 2000 2000 5000 2000 5000 5000 2000 5000 ans: 940 4 4 0 0 3000 0 3000 3000 0 3000 1000 1000 -2000 1000 -2000 -2000 1000 -2000 ans: 940 4 3 0 0 30000 0 30000 30000 0 30000 10000 40000 40000 10000 40000 40000 ans: 7011.0678118655 4 4 0 0 3000 0 3000 3000 0 3000 -1000 1000 5000 1000 5000 2000 -1000 2000 ans: 1940 4 4 0 0 3000 0 3000 3000 0 3000 -1000 2000 1000 -1000 2000 -1000 -1000 2000 ans: 647.1067811865 3 3 0 0 4000 2000 0 4000 3000 2000 7000 0 7000 4000 ans: 387.2135955000 Also, WA6 = integer overflow Can you give me any hint or any tests? Thanks in advance. I also WA5. When I consider K > 1000, I got AC. The graph is directed i.e. 8 is connected to 5 but 5 is not connected to 8. So that means if the input is 1 8 5 8 5 6 then the answer will be impossible. Edited by author 30.11.2010 02:14 Well, here are some hints: 1. Use DFA. If you do'nt know what it is, visit this page http://en.wikipedia.org/wiki/Deterministic_finite_automaton (pay attention to the table of states) 2. use getc() instead of cin>>ch or cin.getch() or whatever you use (for C++/C only) 3. Try this: 3 outputoutputinputon inputone Edited by author 13.06.2007 17:36I would recommend using gets() for all that want to have the whole string at once. It still is fast enough and does not time limit. How exactly do you use DFS for this? Can you provide an example of some other problem similar to this which is solvable by DFS? Thank you. It's Not DFS problem!!!!! It's DFA(Deterministic finite automaton) problem! I solved it with DFS in 0.453 sec. When I was using STL, I always had TL on the first test but I was sure that this is the correct algo. Then I replaced all STL's strings with array of chars and I got ACC 0.078 . OMGWTF ?! First test is really large. Something of order 1e6. Its a simple substring search problem. I have WA on test 7. What i need to do? Output is EndPoint. EndPoint is simple. 4 3 1 1 1 2 2 2 3 3 3 4 4 4 > 0 my solution is: edge number + component number - 1. Use long long Not work. Can i give my code? What is test 5? I can give my code(It's not working), runtime error(access violation) you can use Binary Lifting,find lca of u and v you find distance u with root of tree the result=dis[a]+dis[b]-2*dis[lca(a,b)] No clue as to what's wrong. Can anyone please give me a hint or what's the case? you can show your code , i can help you |
|
|