|
|
I'm getting WA on 13th test. What's wrong with that test? I urgently need help. At least, I amnot getting TL. By the way, are there only 3 banknotes? Maybe test is not correct. And according to conditions of this problem, a number of some of them should be >= ( n / 2 ) if n = even; and > (n + 1) / 2 if n = odd. Is it right? I'm getting a Crash on test 2. What the hell is that test? Anyone knows? Plz help me... I could post my Java program. try to use arrays some larger than the number of elements Code with this: for (int i=0; i<n; i++) { int t; scanf("%li", &t); ... gives wa1 Code with this: for (int i=0; i<n; i++) { int t; cin >> t; ... gives tl36. Help, please, if know what is the problem Use scanf("%d", &t). There is 32bit compilers. Tried, result is exactly the same: wa1 I use: 1)sort 2)count algorithm in the loop to get the number>N/2; that loop iterates each elem. of a container... How to avoid Time Limit..? I have three ideas: 1) Use fast sorting algorithm 2) Don't use containers. I don't like it because it is too hard to debug solutions while using it, and i think containers works slower. 3) Don't use sorting at all. Try to find O(N) algortihm. I was getting WA for this task, when I used mergesort (and in other tasks too). But when I changed to binary heap sort, I got AC... It seems that something is wrong with your mergesort. Certainly. What about problem 1090? It's my program [code deleted] what??? Edited by moderator 29.12.2006 09:21 If you correct all your bugs ur algo will get TL Hey, I wrote this code, but it fails on the 6th test... What can be my error? [code deleted] Edited by moderator 29.12.2006 09:21 I don't know how I did it, I had same code and same was the trouble (WA 6)! I'd also taken into consideration the condition that more than half of numbers are equal. [code deleted] Edited by moderator 29.12.2006 09:21 AC solution: use qsort(A) and then output A[n/2] my program has Wa on 1 test... [code deleted] Edited by moderator 29.12.2006 09:22 if the answer is a0. delete a0 and a1 (a0!=a1) the answer is still a0 Edited by author 29.10.2006 16:21 Is only a maximum of 3 different varieties of bank notes possible? I supposed that there are can be more than 3 banknote types and get AC. I think in both cases it is so easy. What causes TLE #21 what is the trick? I have the same problem. But I can't understand. Is such test correct? //-------------- 7 3 2 1 3 3 3 4 //-------------- I think it's wrong. Am I right? Use sort, then find longest sequence. It's correct. The answer is 3. |
|
|