Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
Insight | classenemy | 1494. Монобильярд | 16 май 2024 23:20 | 1 |
Insight classenemy 16 май 2024 23:20 There is only one eligible lowered numbered ball at any round. Keeping track of this should result in O(n) solution |
another hint | So Sui Ming | 1209. 1, 10, 100, 1000... | 15 май 2024 06:02 | 2 |
Stack 1,10,100,1000,10000,100000,... vertically: 1 10 100 1000 10000 100000 ... the cumulative sums of digits from the top are: 1,3,6,10,15,21,... which are in the form of combination(N,2) = N*(N-1)/2 checking whether one is at Kth digit is the same as finding if there is integer solution to: N*(N-1)/2 = K-1 one way is to solve the quadratic equation for N (in double) and cast N to integer and check the above relation. regards, So Sui Ming Edited by author 16.01.2024 19:27 Edited by author 16.01.2024 19:27 Great solution, So Sui Ming, I did not think about that one in particular. I just use prefix sums and binary search. If you write down the sequence and it's index starting from 1. You will notice that if you do prefix sum ( half interval way , so starting from 0, the first element, first element + second element, etc. ) up till sum <= MAX ( 2^31 - 1 ), you will get 65535 numbers in a sorted way. In this way, notice, that the numbers in this prefix_sum array are all index s.t. digit = 1. You still need to +1 in every position of prefix_sum array, because of 1-index of input. Now you read input number K and do binary search on the prefix sum array. If you did find, great! It is 1. Otherwise, it is 0. |
Tips without answer, but it's useful | Pedro[UFES] | 1209. 1, 10, 100, 1000... | 15 май 2024 05:53 | 1 |
Write down the sequence, on paper, by hand. Now, right down the index of each digit on the sequence. Do you know prefix sums and binary search? It's kinda useful for many problems btw... Edited by author 15.05.2024 05:54 |
Help please!!!! WA 3 | Emris | 1013. K-ичные числа. Версия 3 | 12 май 2024 17:09 | 2 |
I solved 1009 and 1012. Now im using new algorithm (log(n)) and program works fast and correct with my tests. Can you give more tests? I solved 1013, my mistake was multiplication of large numbers, i use long arithmetic for multiplication and uint64 for variables and get Accept |
Overrated | FaNato4kA_TiMoFeYa | 1809. Чапаев и картошка | 12 май 2024 15:40 | 1 |
Overrated FaNato4kA_TiMoFeYa 12 май 2024 15:40 |
WA #5 wrong answer | Theodike | 1306. Медиана последовательности | 10 май 2024 14:40 | 4 |
My code is here: -------------- #include <iostream> using namespace std; int compare(const void * x1, const void * x2) { return (*(int*)x1 - *(int*)x2); } int main() { long N; cin >> N; int *m = new int [N]; for (int i = 0; i < N; ++i) { cin >> m[i]; } qsort(m, N, sizeof(int), compare);
if (N % 2 == 0) { cout << (((m[(N - 1)/ 2] + m[N / 2]) / 2.0)*10)/10; } else { cout << m[N/2]; } return 0; } -------------- Tell me please where I made a mistake Try the following test: 4 2147483647 2147483647 2147483647 2147483647 I tried to use if(arr[n / 2] == -1)cout << "2147483647"; but I still have WA on test 5 |
Please, explain me the Sample! | Bahturin Alexander (SibSUTI#2) | 1180. Игра с камушками | 9 май 2024 22:22 | 3 |
I can't understand it... If N1 takes 2 stones at first move, he will lose, won't he? 1:8 - 2 = 6 2:6 - 2 = 4 1:4 - 2 = 2 2:2 - 1 = 1 1:1 - 1 = 0 Please, tell me, where I'm wrong? Ooops... Bahturin Alexander (SibSUTI#2) 10 дек 2005 14:45 I understood my mistake. Sorry. |
info on orientation of cube | So Sui Ming | 1016. Кубик на прогулке | 9 май 2024 21:36 | 1 |
if the cube is at e2, neighbors are: e1 (near), e3 (far), d2 (left) and f2 (right) |
24 orientations of cube + small test case | So Sui Ming | 1015. Найдите различия! | 7 май 2024 09:30 | 1 |
for your convenience 24 orientations of cube: 1 2 3 4 5 6 1 2 4 5 6 3 1 2 5 6 3 4 1 2 6 3 4 5 2 1 3 6 5 4 2 1 4 3 6 5 2 1 5 4 3 6 2 1 6 5 4 3 3 5 1 6 2 4 3 5 2 4 1 6 3 5 4 1 6 2 3 5 6 2 4 1 4 6 1 3 2 5 4 6 2 5 1 3 4 6 3 2 5 1 4 6 5 1 3 2 5 3 1 4 2 6 5 3 2 6 1 4 5 3 4 2 6 1 5 3 6 1 4 2 6 4 1 5 2 3 6 4 2 3 1 5 6 4 3 1 5 2 6 4 5 2 3 1 test: 4 1 4 2 3 6 5 1 4 3 6 5 2 1 4 5 2 3 6 1 4 6 5 2 3 ans: 1 1 2 3 4 |
Funny | pocochuk | 1915. Руины титанов: воссоздание былого | 6 май 2024 00:05 | 1 |
Funny pocochuk 6 май 2024 00:05 |
Формула Пика ван лав!!! | Egor Sibriaev | 1139. Городские кварталы | 4 май 2024 21:47 | 2 |
|
I got Accepted in Java !!! | Enigma [UB of TUIT] | 1119. Метро | 4 май 2024 21:23 | 3 |
Can you send me solution on elsocm5@gmail.com? Thank You! |
Great task | FaNato4kA_TiMoFeYa | 1358. Провода | 4 май 2024 20:17 | 2 |
It would be interesting to solve such a problem on an arbitrary graph (not a tree) or to say that there is no solution for such a graph. |
To admins | Sergei Barannikov | 2102. Миша и криптография | 3 май 2024 17:22 | 3 |
To admins Sergei Barannikov 19 окт 2019 09:51 Please add the following testcase: 869637034218881024 = 2^18 * 1806487 * 1836383 The answer should be "Yes". My solution prints "No" and nevertheless has AC. Thank you! Good test. I found another good one. 999979520100663296. I think it's stronger. However I got AC before, but i was looking for a good test. Edited by author 29.10.2019 00:37 One of the largest allowed numbers 999999999987679232 = 2^19 * 1907348632789 where the second multiplier is a prime number. |
Hint for WA12 | denxxjkee | 1074. Очень короткая задача | 1 май 2024 20:18 | 1 |
For WA12 try this: 9126492316491641269352615215701236589213658621356281376589216562319562396592381659862195621281E-190 100 # Output must be: 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009126 |
Still got WA2 but all test in other themes is passed | denxxjkee | 1074. Очень короткая задача | 1 май 2024 15:44 | 2 |
Try this: .234 2 .2 2 # Answers: 0.23 0.20 |
Overrated | FaNato4kA_TiMoFeYa | 1728. Проклятие Team.GOV | 1 май 2024 00:53 | 1 |
Overrated FaNato4kA_TiMoFeYa 1 май 2024 00:53 |
VC is faster G++!!! | Vit Demidenko | 2027. URCAPL, эпизод 1 | 30 апр 2024 12:15 | 3 |
3 times! what the reason? vc++ 0.328 sec g++ 1.078 sec upd. in 3 problems vs is really faster than g++ (2-3 times). Compiler problem? Edited by author 28.10.2014 17:39 Edited by author 28.10.2014 17:39 LOL I have AC in G++11 with time 0.093 s, some other people have AC with 0.031 s. How did you solve this problem with 1.078 s? xD This is absolutely not true |
WA 18: wrong order of points in polygone | Alex_Gu | 1215. Точность попадания снаряда | 29 апр 2024 19:56 | 1 |
The test contents points entered clockwise, which doesn't respond the condition. I succeed passing the test only after applied an algo, which is not sesitive to the order of points in polygone Edited by author 29.04.2024 19:57 Edited by author 29.04.2024 19:57 |
wrong answer C++ | Igor | 1001. Обратный корень | 29 апр 2024 11:23 | 2 |
I want to solve the problem using a dynamic array. But the compiler outputs this: HEAP CORRUPTION DETECTED: after Normal block (#150) at 0x000001EEFBCDB420. CRT detected that the application wronte to memory after end of heap buffer. #include <iostream> #include <cmath> #include <iomanip> using namespace std; void main() { int size = 0, i = 0; int* a = new int[size]; unsigned int x; while (cin >> x) { size += 1; for (; i < size;++i) { a[i] = x;
} }
for (int i = size-1; i >= 0; --i) { cout << fixed << setprecision(4) << sqrt(a[i]) << endl; } delete[] a; Edited by author 20.03.2023 12:40 Type int will overflow. Use unsigned long long instead. |