| Show all threads Hide all threads Show all messages Hide all messages |
| WA #11 HELP | Furkat Ahrolov | 1931. Excellent Team | 5 Dec 2021 02:10 | 1 |
What is test 11? Edited by author 05.12.2021 02:11 |
| Why p is prime? | Dirichlet | 1560. Elementary Symmetric Functions | 3 Dec 2021 20:36 | 6 |
Is it possible to use somehow that p is prime? My AC solution doesn't use this fact, but I'm wondering is there a simpler way to solve this task. Complexity is (M + N) * log N, where N is a size of the array and M is a number of queries I needed primality of 'p' when I calculated S(K) from sums of powers for Ai. I needed to divide by 2, 6 or 24 in the end. Primality plays important role when you find inverse of these divisors modulo 'p'. Also the fact that S>1000 was also convenient fact because some multiplications would turn to zero for quite small p. This problem is named "Elementary Symmetric Functions". There is formula (by Newton) that gives relation between elementary symmetric polynomials and "power sums" (that are symmetric too). Formula used division that can be done in general case only by prime modulo. But it can be solved without knowing any special about these polynomials. In this case solution doesn't need the primality of P. And then we have a data structure problem only, not number theoretical :) I used interval tree and memoization of sums on subsegments. And still the 4 seconds limitation is too large. upd: Fenwick tree is better ;) Edited by author 10.09.2011 23:40 I understand how to solve the problem with combinatoric formula and 4 segment trees, can you please explain the second way? |
| Мне жалко этого дедушку | Виталий Черков | 1457. Heating Main | 3 Dec 2021 09:16 | 5 |
А мне жалко стану, которая до сих пор живёт так( Да боже. Вы, тупые нытики, даже на сайте с программированием ноете. Как же вы задолбали уже. Никто так не живёт |
| Hint for everybody! : ) | Pavel Nikolov | 1084. Goat in the Garden | 2 Dec 2021 10:06 | 6 |
Hi I think that we should help each other. If someone resolves a problem he/she must help the others with materials or links where the algorithm/formula is explained. This is the reason we are users of such sites - because we want to improve our programming skills. So I decided to help all of you who find this problem difficult. Here you can find help: http://en.wikipedia.org/wiki/Circular_segment http://www.mathopenref.com/segmentarea.html The rest is up to you! HTH Edited by author 22.10.2013 12:23 thanks dude, i didn't even understood what the question was asking :) Thanks, bro, you are real man! |
| C++ wrong answer test1 | hjkhg | 1877. Bicycle Codes | 30 Nov 2021 13:38 | 2 |
i checked it manually and answer was correct. Why does if fail? Code: #include <iostream> int main(){ std::string lock1, lock2; std::string result = "yes"; int code = 1; int lock_val1, lock_val2, cur_value; bool lock_state = false; std::cin>>lock1; std::cin>>lock2; lock_val1 = std::stoi(lock1); lock_val2 = std::stoi(lock2); while (code < 10000) { if (lock_state == true){ cur_value = lock_val1; } else{ cur_value = lock_val2; } if (code > lock_val1 && code > lock_val2){ result = "no"; break; } if (code == cur_value){ break; } lock_state = !lock_state; ++code; }
std::cout << result << std::endl; return 0; } Edited by author 30.11.2021 13:19 Edited by author 30.11.2021 13:19 Edited by author 30.11.2021 13:24 Edited by author 30.11.2021 13:37 It passed, there was a typo. |
| Test 10 Division by zero | andreyDagger | 1291. Gear-wheels | 29 Nov 2021 16:59 | 1 |
When i used dfs, i was getting "Division by zero" on 10 test. Then' i switched to bfs and got AC. Can you explain me: WHY? |
| For WA#12 | springWaltz | 1145. Rope in the Labyrinth | 29 Nov 2021 14:49 | 1 |
|
| give me some test please!!! | bilol | 1701. Ostap and Partners | 28 Nov 2021 23:44 | 7 |
Check this test 4 3 1 2 100 3 0 100 1 3 -100 Impossible after 3 statements Edited by author 04.04.2009 22:09 But I think the answer should be "Impossible after 1 statements"...I used BFS and I also got WA on test 7 afte statement 1 it will be: 0 100 0 problem?!?!? Edited by author 17.05.2014 22:59 before AC my prog failed on these tests: 1) 7 3 2 1 1000000000 3 1 15 4 5 -20 answer: Possible 0 0 1000000000 15 0 20 0 2) 7 4 2 1 1000000000 3 1 15 4 5 -20 4 2 1 answer: Impossible after 4 statements 3) 8 4 1 2 200 2 3 999999800 3 1 -1000000000 4 0 5 answer: Possible 0 1000000000 999999800 0 5 0 0 0 Test 2 is not correct due to statement restrictions. |
| Stupid task (RTE 13) | andreyDagger | 1941. Scary Martian Word | 28 Nov 2021 11:47 | 1 |
Length of the first string can be bigger than length of the second string. I spent 15 submissions to realise this |
| Pay attention | andreyDagger | 1007. Code Words | 27 Nov 2021 17:07 | 1 |
1) First test is not sample 2) There are not n strings in input |
| My stupid solution | andreyDagger | 1407. One-two, One-two | 27 Nov 2021 13:25 | 1 |
So, if you have a number, that divides 2^n, than you can add some numbers in the begining (not more than 10) to get number, that divides 2^(n+1). That means, you can bruteforce all possible numbers, that you can add in the begining. Works in O(n*2^10) |
| WA 7 = mind the coordinate order in the output | Otrebus | 1486. Equal Squares | 26 Nov 2021 19:00 | 2 |
Could you be more specific? Because I try: 1. Point (row, col) closest to point (1,1) first (distance formula). 2. Row closest to row 1 first. 3. Other variations And I still get WA7. |
| Visual C++ copilers | sasha_clear | | 26 Nov 2021 17:13 | 1 |
I've tried to submit the same code with different compilers and have received "compilation error" from MS Visual C++ compilers ans "accepted" from G++ and Clang++. On my laptop with MS VS 2019 this code also runs. The question is are compilers on the server ok? |
| wa9 | Лев | 1795. Husband in a Shop | 25 Nov 2021 23:39 | 1 |
wa9 Лев 25 Nov 2021 23:39 the store had the product, but sold it = the store did not have the product if (!Products.count(name) || !Products[name]) Purchases.erase(Purchases.begin() + i); |
| If you get WA9 | Mescheryakov_Kirill [SESC17] | 1795. Husband in a Shop | 25 Nov 2021 23:18 | 2 |
Test: 1 10 of gg 3 1 of ff 10 of gg 9 of gg Correct Answer: 3 Edited by author 25.11.2021 23:40 |
| How to avoid overflow | andreyDagger | 1513. Lemon Tale | 24 Nov 2021 12:58 | 1 |
|
| Another easy approach | andreyDagger | 1229. Strong Brickwork | 24 Nov 2021 10:53 | 1 |
You can always fill 2 * m area |
| Why WA1? | Peshkov [57 lyceum tlt] | 1229. Strong Brickwork | 24 Nov 2021 10:50 | 2 |
Why WA1? Peshkov [57 lyceum tlt] 13 Jul 2020 12:15 My program got WA1 with answer 1 2 3 4 1 2 3 4 on example test Why? |
| lol tle 42 | >>> | 1915. Titan Ruins: Reconstruction of Bygones | 24 Nov 2021 07:59 | 1 |
tle 42 -ios_base::sync_with_stdio(0); but ios_base::sync_with_stdio(false); cin.tie(NULL); - ACCEPTED with 0.015) |
| range tree | lxn | 1896. War Games 2.1 | 22 Nov 2021 01:13 | 12 |
Is there a solution without randge tree structure? I use Fenwick Tree get AC,0.452 seconds There possible segment tree with uint16_t for indexes greater than 2^15, and uin32_t for less 2^15. (two arrays: uint16_t tree[N+N]; and uint32_t rem[32768] ) But I got WA38 (( I Got AC with segment tree!! uraaaaa. You can use segment tree where vertex is segment with length=4. 1 2 3 4 5 6 7 8 9 10 => [1,2,3,4] [5,6,7,8] [9,10,11,12] Memory is N*sizeof(int)+N*sizeof(bool) Complexity is N*log(N/4)*4+N*log(N/4) decomposition also works here, i've chosen amount of block about 300 I can't do that. C/C++. I am using two cycles. One to set up Fenwick tree and one to calculate the answer. Probably you are avoiding the use of the set up cycle somewhat. I tested my solution on war games 2 and have got 93 ms. UPD: got 46 ms on version 1 Edited by author 09.07.2017 22:20 Finally, I understood how to get rid of initialization cycle. Still TLE the same test 37. Maybe bitwise operations are faster with UNSIGNED integers... So, I tried to not calculate cnt=n-i+1 every iteration, made while (1) cycle, not call decrement on Fenwick tree after last soldier. TLE#37. My mistake was I was using queries for O(log(N) *log(N)) time in Fenwick tree But for that task, there are suitable queries in just O(log(N)) |