Common BoardThis test was failing on my solution. Other similar (symetric) tests could fail other similar (symetric) solutions. Input: 2 1 -999999999 0 -999999999 1 What's wrong with this test? i have the same question. what's the catch? and what's with the "ambiguous" case? how can it be ambiguous? When tank angled too much, one or more of sensors will show 0. If 3 or 2 neighboring sensors shows 0, then you cant determine the angle, but at whole data is not erroneous, so you shall output "ambiguous" for exampe 10 0 1 1 0 - ambiguous 10 0 1 0 1 - error 10 0 0 0 0 - 0.0 10 0 1 3 1 - 104.166667 (not error!) 10 0 1 3 2 - 150.0 10 0 1 5 3 - 202.083333 10 0 1 3 5 - error Edited by author 01.05.2011 03:36 OMG, my program passed all these tests, but still WA#2. Do you have any other tricky tests? I don't know ;) naive o^2 * (h1 + h2 + h3 + h4) / 4 will pass test #2 (with checking erroneous data preliminarily of course) and will WA only at #3 try swap data, like this: 10 0 1 3 2 10 2 0 1 3 10 3 2 0 1 10 1 3 2 0 etc. Edited by author 01.05.2011 02:41 Of course, I considered this case. Now I have WA#4. This test helped me a little: 1000000 1000000 1000000 1000000 1000000 -> 1000000000000000000.000 I guess, there are exists such tests, where, while calculating the volume, the itermediate calculations exceed 2^64. The reason of WA seems to be this. P.S. Don't like Java :) bsu.mmf.team, did you find the mistake? What is it? Edited by author 05.05.2011 16:26 I've used extended (in Pascal) to perform all calculations. But I think precision of double also enough to perform it, because required "relative error of at most 10^6". I hope you're not using integers of any size to perform real-number calculations? ;) --- I've just sent my solution replacing extended to double - it still have AC. But when I replaced it again to single (Pascal) - I got WA #4. So, if you using float (in Java) you have to replace it with double Edited by author 05.05.2011 18:40 Yes, I found my mistake. I got AC after I changed my function, which checks if 4 points lie on the same plane. I rewrote it using only integer calculations. what the wrong with test case 2 ,passing all of the forum :(.help pls..!! Friend! Your swapping-advice very right but very very dangerous! My ideal AC program had 12 lost submissions due bad swapping. Example: 0 1 3 2 -> 3 1 0 2- good. 1 0 3 2 -> 1 3 0 2 - bad! But double swapping swap(y2,y3),swap(y1,y4) 1 0 3 2 ->2 3 0 1 - right again! P.S. Why 1 0 3 2 -> 1 3 0 2 - bad? In 1,0,3,2 we have ciclic 3>2>1>0 but in 1,3,0,2 this invariant killed ,nature of data changed. Edited by author 25.10.2011 11:07 This is what helped me pass WA #2: Input: 1 10 0 1 4 1 Output: 114.814815 Before you look at the solution I have to clear up some confusion. If we are talking about the lowest bound it takes for the program to complete, then it is O(N^2), because you have to evaluate each table cell no matter what and print the value. This is also considering that by N we denote the side of the table. On the other hand, the function that takes in i and j and spits out the correct number in O(1) **is possible** without any lookup, which can be also be parallelized and be ported as fragment shader. You can see it below, it's the `eval` function and all calls are independent of their neighbors. The core challenge is to figure out how to calculate which diagonal are you on -- I call it level -- and what is your local index on that diagonal line. For example, for N=3, we have: 4 2 1 7 5 3 9 8 6 where, "1" is on the first level, "2,3" are on the second level, "4,5,6" are on the third level and so on. Furthermore, 6 is the third number on that line. ```cpp #include <stdio.h> int abs( int x ) { return x >= 0 ? x : -x; } int sum( int n ) { return ( n + 1 ) * n / 2; } static int n; static int totalLevels; static int topRight[2]; int eval(int i, int j) { const int level = abs( topRight[ 0 ] - i ) + abs( topRight[ 1 ] - j ); if( level < n ) { const int origin = n - 1 - level; const int index = i - origin; return 1 + sum( level ) + index; } else { const int index = i; return 1 + n * n - sum( totalLevels - level ) + index; } } int main() { scanf("%d", &n); totalLevels = n * 2 - 1; topRight[0] = n - 1; topRight[1] = 0; for( int j = 0; j < n; ++j ) { for( int i = 0; i < n; ++i ) printf("%d ", eval( i,j )); printf("\n"); } return 0; } ``` try this test: 1 1 3 100 3000 ans: 1000 For this test, the correct answer is: 1020 take sample output and map it affinly to data triangle and you will have AC Edited by author 24.03.2026 20:05 Please tell me this test and tell me if the three-time repetition of the position by the king is taken into account (in chess, in this situation there is a draw) Three-time repetition or the fifty-move rule are not considered in this problem (or at least I didn't implement them and got AC). I was getting WA #4 because I printed the board and stopped processing the moves after a "Check" message. After fixing this issue I got AC. I use 'set' in python. Very simple. But I have WA3. Don't know why. Please help. Hi! I believe test #3 is invalid - there is no way to get from floor 1 to floor N. Can you please check? Thank you! Test is valid, but a bit unusual :) Try the boundary cases Tricky test case (even can't find its analogue). It contains such placement of draughts that you should precisely touch one or several other draughts by your move, and almost identical angles (+/- 1e-8 radians) will not give correct answer. When allow precisely touch got AC. P.S. Seems like one enemy draught you touch on the left side and other one - on the right side simultaneously. Edited by author 23.04.2023 18:44 In my case: double -> WA 35 long double -> AC Is this a rounding issue in the output? I had WA13 when i was printing 6 digits. More digits are needed. Thank you, I have AC now. In my implementation, it took 9 digits, but you can output much more just in case. Edited by author 19.03.2025 08:24 double -> WA #13 long double -> AC input: 804289384 2 36 94 795951522 804289383 output: 8556270 631 8 902 694 854 198 479 378 808 647 53 134 77 91 493 13 597 802 ans: 22 86 15 27 93 95 30 85 88 26 17 78 66 49 60 52 21 96 85 55 45 2 69 1 47 18 20 96 80 66 8 70 51 ans: 22 75 3 49 97 16 10 10 36 ans: 8 be more careful about formulas useless you're sitting right next to me. you could say it to me in the face... These are very good tests! If the middle nail was hammered, then the left and right become adjacent? Answer: NO Edited by author 10.03.2026 13:47 The vectors may have negative coordinates. Я написал рекурсию которая каждый раз делила отрезок на два и брала максимальный среди ответа всех таких отрезков которых поделила.(типо Merge Sort). У меня был memory limit на 3 тесте. Это значить рекурсия берет память? Да, берёт. Рекурсия хранит итерации в стеке. Не знаю, работает ли это с рекурсией, но для очистки ненужной памяти можно использовать эту библиотеку (если на Python): import gc gc.collect() # убираем ненужное Там был тест на n = 0. Я тоже пытался решить через разделяй и властвуй и на n = 0 у меня все падало n,k = map(int,input().split()) if k==1 or n==1: print(2*n) else: if 2*n%k==0: print(2*n//k) else: print(2*n//k+1) N,M = map(int,input().split()) k = [] for _ in range(M): m = int(input()) k.append(m) for i in range(1,N+1): print(f"{k.count(i)*100/M:.2f}%") Time limit please help |
|