Common Board 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 What does it mean: "reach smth"? It's a strict condition, but how should i understand it?) In my opinion, this sample has two right answers: 4 0 0 0 1 0 5 0 8 2 * (1.5 * 1.5) * M_PI or (1 + 3 * 3) * M_PI. You have to find the largest possible answer. Thus the correct answer is: (1 * 1 + 3 * 3) * M_PI = 31.4159 input: 2 8 12 28 40 46 48 54 60 80 2 7 9 24 34 49 54 62 66 77 78 79 80 83 84 84 output: 6 input #1: 3 110 output #1: YES input #2: 4 1110 output #2: NO Edited by author 24.02.2026 17:26 12 12 5 3 11 2 8 4 9 1 6 10 7 answer: 34650 in example output. But, following full check test prints 6300. ----- static bool match(int a[], int n, int b[], int m){ if (n != m) return false; if (n == 0 && m == 0) return true;
int i = std::max_element(a, a + n) - a; int j = std::max_element(b, b + m) - b;
return i == j && match(a, i, b, j) && match(a + i + 1, n - i - 1, b + j + 1, m - j - 1); } int main() { int n = 12; int a[] = { 12, 5, 3, 11, 2, 8, 4, 9, 1, 6, 10, 7 }; int b[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; int ans = 0; do{ if (match(a, n, b, n)) ++ ans;
} while (std::next_permutation(b, b + 12) );
printf("ans = %d\n", ans); return 0; }
The second example is correct. In your code, you should replace std::max_element with std::min_element to get the correct answer. |
|