Show all threads Hide all threads Show all messages Hide all messages 
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? 
What's in the 2nd test?  Glumaks  2066. Simple Expression  3 Dec 2021 19:08  1 
#include <stdio.h> int main(void) { int a, b, c, max, min, med; scanf("%d %d %d", &a, &b, &c); max = a >= b && a >= c? a: b >= a && b >= c? b: c; min = a <= b && a <= c? a: b <= a && b <= c? b: c; med = a + b + c  min  max; if (med == 0) printf("%d",  max); else printf("%d", min  max * med); return 0; } 
Мне жалко этого дедушку  Виталий Черков  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! 
Формула Пика ван лав!!!  Egor Sibriaev  1139. City Blocks  2 Dec 2021 03:31  1 

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. Gearwheels  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. Onetwo, Onetwo  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) 