| Show all threads Hide all threads Show all messages Hide all messages |
| python wrong answer help | akidra_8881 | 1366. Presents | 27 Aug 2020 12:50 | 4 |
import itertools surprize =[] x = int(input()) while x > 1: x -= 1 surprize.append(x) print (len(list(itertools.permutations (surprize)))) # n = (n - 1) * ((n - 1) + (n - 2)) surprise = [] def f(): number = int(input()) number = (number - 1) * ((number - 1) + (number - 2)) surprise.append(number) f() print(surprise[0]//3) Edited by author 23.08.2020 08:05 Edited by author 04.09.2020 14:21 Edited by author 04.09.2020 14:21 # wrong answer 11 def F(n): if n<2: return 1 return n*F(n-1) n = int(input()) print (int((F(n)+1)//2.718281828459045)) Try this formula f(n) = (n-1)*(f(n-1)+f(n-2)) ;) Edited by author 27.08.2020 12:50 Edited by author 27.08.2020 12:50 |
| Hint and Solution | AleshinAndrei | 1562. GM-pineapple | 26 Aug 2020 19:26 | 1 |
It's very easy to calculate this integral. But if you don't know what's integral, there are solution In-first, i calculated a k k = (a^2 * b * pi / 8) (or a*a*b*0.39269908169872415480783042290994 :) ) In-second, you should calculate y (or other symbol) from 1 to -1 with division (if n = 5: 1, 3/5, 1/5, -1/5, -3/5, -1) In-third, calculate F(y) = y*(1 - y^2 / 3). (F(1) = 2/3) in-fourth, print k*(F(yi) - F(y(i-1))) in loop example: if n = 2: first calculate should be k*(F(1) - F(0)), second k*(F(0) - F(-1)) if n = 3: 1) k*(F(1) - F(1/3)); 2) k*(F(1/3) - F(-1/3)); 3) k*(F(-1/3) - F(1)) etc. |
| Standard Interval tree with sum can be used (-) | Levon Oganesyan | 1061. Buffer Manager | 26 Aug 2020 01:40 | 1 |
|
| Solution | kaiboy | 1061. Buffer Manager | 26 Aug 2020 01:07 | 2 |
[code deleted] Edited by moderator 02.09.2020 19:58 Do not post Accepted solution to the forum! |
| How to solve with Kotlin | vodka2 | 1124. Mosaic | 25 Aug 2020 21:48 | 1 |
If you want to get AC for a Kotlin solution, you should probably use java.util.Scanner instead of readLine() and try multiple times. I was able to get AC only on the second try with the same code, got TLE first time. |
| greedy | guilty spark | 1203. Scientific Conference | 25 Aug 2020 06:16 | 2 |
greedy guilty spark 25 Aug 2020 00:06 Read tasks and deadlines from the programmer's handbook. similar greedy approach will work in this one. Also, why is this tagged dp? my dp soln is giving tle My DP solution works in ~0.001 seconds, please optimize your DP. |
| Задача | a2ch | 1150. Page Numbers | 24 Aug 2020 22:12 | 1 |
Друзья, если вам не принципиально какую задачу порешать вечером - ищите другую. Решение к этой задаче легко придумать за 5 минут... А потом искать 4 часа ошибки (ибо они будут 100%) Удачи. |
| You can use a segment tree for brace balance checking | Levon Oganesyan | 1574. Mathematicians and brackets | 24 Aug 2020 13:08 | 1 |
Tree for minimum is enough. |
| sorry but why WA4? | qulinxao | 1671. Anansi's Cobweb | 24 Aug 2020 04:03 | 1 |
hm.ok Edited by author 25.08.2020 03:14 |
| Why WA#8? | Chernov Andrey [Vladimir SU] | 1574. Mathematicians and brackets | 24 Aug 2020 00:32 | 5 |
Why WA#8? Chernov Andrey [Vladimir SU] 13 Oct 2007 15:43 I algo had WA8. This test helped me: ())()))((()( Answer: 1 No, it is bad test if WA8, this test help me ()()())()( +1 Thank you! Edited by author 17.11.2011 20:40 |
| #MLE 14 | LaVuna [NULP] | 1220. Stacks | 21 Aug 2020 01:11 | 2 |
#MLE 14 LaVuna [NULP] 19 Aug 2020 20:46 How to solve this problem using c++ ? My pick is #MLE 14. I use (10^5 + 1000)*4 + 10^5 * 2 = 589,84375 kilobytes of memory. I have no idea how to optimize it even more( Edited by author 20.08.2020 02:34 Edited by author 20.08.2020 02:34 hint LaVuna [NULP] 21 Aug 2020 01:11 I solved this problem. I can only suggest you to think about headers.In this problem this cost a lot. To save memory,you must count total amount of bits that you need and use nearly that amount of space. Use bitwise operators to write and read numbers. Edited by author 21.08.2020 01:15 |
| Weak tests | SendThemToHell | 2142. Magic | 21 Aug 2020 00:48 | 1 |
My AC code gives "No" on the following testcase due to the overflow 1000000000 1000000000 1000000000 0 0 0 |
| WA2 | AleshinAndrei | 1588. Jamaica | 19 Aug 2020 23:26 | 1 |
WA2 AleshinAndrei 19 Aug 2020 23:26 How do you think what's the input-data in test-2? I did tested my program around 10 times :) but i didn't find mistake(( UPD: N = 1 ))) you mustn't test borders-cases in input data. You must check your algorithm. In this case i have "out of range" (because v_arr has length = 0, but in this program i don't check it and i address to zero index). If check border-case this algorithm is working My program: @@ #include <iostream> #include <cmath> struct Point { int64_t x; int64_t y; }; struct Vector { double r; double angle; }; int cmp(const void *a, const void *b){ Vector* v1 = (Vector*)a; Vector* v2 = (Vector*)b; double ans1 = ((v1->angle) - (v2->angle)); if (ans1 < 0){ return -1; } else if (ans1 > 0){ return 1; } double ans2 = ((v1->r) - (v2->r)); if (ans2 < 0){ return -1; } else if (ans2 > 0){ return 1; } return 0; } int main() { int N; std::cin >> N; Point p_arr[N]; Vector v_arr[N-1]; double dist = 0; int64_t dx, dy; for (int i = 0; i < N; ++i){ std::cin >> p_arr[i].x >> p_arr[i].y; } for (int i = 0; i < N; ++i){ for (int j = 0; j < i; ++j){ dx = p_arr[j].x - p_arr[i].x; dy = p_arr[j].y - p_arr[i].y; v_arr[j].r = sqrt(dx*dx + dy*dy); v_arr[j].angle = atan2(dy, dx); } for (int j = i+1; j < N; ++j){ dx = p_arr[j].x - p_arr[i].x; dy = p_arr[j].y - p_arr[i].y; v_arr[j-1].r = sqrt(dx*dx + dy*dy); v_arr[j-1].angle = atan2(dy, dx); } qsort(v_arr, N-1, sizeof(Vector), cmp); for (int j = N-2; j > 0; --j){ v_arr[j].angle -= v_arr[j-1].angle; } dist += v_arr[0].r; for (int j = 1; j < N-1; ++j){ if (v_arr[j].angle != 0){ dist += v_arr[j].r; } } } printf("%.0f", (dist / 2)); } @@ Edited by author 20.08.2020 00:55 |
| what's output for N=5,K=10?? | Suphanat Chunhapanya | 1009. K-based Numbers | 19 Aug 2020 13:21 | 5 |
and also N=6,K=10 N=7,K=10 N=6,K=2 N=5,K=10 the answer is 87480 N=6,K=10 the answer is 866781 N=7,K=10 the answer is 8588349 N=6,K=2 the answer is 13 my program has been accepted I have solved this problem,but I got WA on test #2.When n=6,k=10 I get answer 866781 and others tests I get right answer.What is the test #2??????????????? N=5,K=10 the answer is 87480 350975 350974 350973 350971 350970 350967 350966 350965 350959 350958 350957 350955 350954 350943 350942 350941 350939 350938 for n = 6 , k = 2 this values are true more than 13 You are not right because k = 2 => all numerals < 2. Ok? And now I show you this 13 numbers: 111111 111110 111101 111011 110111 101111 111010 110110 110101 101110 101101 101011 101010 sorry for my English Edited by author 19.08.2020 13:21 Edited by author 19.08.2020 13:21 |
| More test cases? | Erin | 1017. Staircases | 18 Aug 2020 20:02 | 1 |
For some reason, my code gets the right answer for all small inputs (<12) but is 1 greater than both the large test cases I've found. It gets that s(212) = 995645336, as compared to 995645335, and s(500) = 732986521245024, as compared to 732986521245023 given before. Anyone have any test cases with an input between 11 and 212 to help me pinpoint this problem? Edited by author 18.08.2020 20:03 |
| What is output for 7? WA#7 | Nodir NAZAROV [TUIT-Karshi] | 2037. Richness of binary words | 18 Aug 2020 11:32 | 2 |
I don't know any string of length 7 contains less than 7 distinct palindrome substrings. Anyone can put the answer for 7, pls? It may be too later. for n = 7 1 : NO 2 : NO 3 : NO 4 : NO 5 : NO 6 : NO 7 : aaaaaaa for n = 15 1 : NO 2 : NO 3 : NO 4 : NO 5 : NO 6 : NO 7 : NO 8 : aababbaababbaab 9 : aaababbaaababba 10 : aaaababbaaaabab 11 : aaaaababbaaaaab 12 : aaaaaaababbaaaa 13 : aaaaaaaababbaaa 14 : aaaaaaaaababbaa 15 : aaaaaaaaaababba |
| It's very beatyfull problem. Thanks | KostyaRychkov | 2105. Alice and Bob are on Bikes | 17 Aug 2020 22:53 | 1 |
|
| Please check my answers on this tests..., are they right??? | Asyamov Igor | 1643. Attack of the Dark Fortress | 17 Aug 2020 20:01 | 12 |
1) in: 3 5 ..*.. !.... ....$ out: 3 2) in: 5 8 ....AA.# .######! ...BA*## .####### ..B$...B out: 3 3) in: 5 8 ....AA.# .######! ....#*## .####### ..B$...B out: Impossible 4) in: 1 3 $*! out: Impossible 5) in: 1 3 *!$ out: 2 I have used BFS, but still WA 22 :-( Edited by author 26.10.2008 13:57 Edited by author 26.10.2008 14:04 Edited by author 26.10.2008 14:17 Now Accepted :-) All my tests are correct!!! Edited by author 26.10.2008 16:17 the army can stay in one point ? so in this input 1 3 *!$ the corresponding output is 2 ? test 22 Sichov Evgeniy (ONPU) 26 Jan 2009 16:22 Can you lell what was wrong with your program? I`m having WA 22... Please give me some test i also used BFS, but have WA10. Your tests are passed on my computer. Could you give more tests? test 21 Vit Demidenko 2 Mar 2010 19:43 5 7 ..!.... ....... .####.* ....... ..$.... Answer: 4 This test help me with wa21 This one helped me to deal with WA10. 1 3 !*$ Answer: Impossible Interesting problem. But only after few WA I understood problem statement correctly :) Re: test 22 Anton Chaplygin[Kungur,Perm kray] 14 Aug 2011 12:49 There is something wrong with limitations is the statement. I set maxN = 300 and got AC. WA 11 MOPDOBOPOT (USU) 5 Aug 2012 02:22 This test helped me to pass WA11: 3 5 .AAA! .A*A. $AAA. output: 2 Another interesting test: 1 12 #AB$#A!B#B*# output: 2 Edited by author 05.08.2012 02:31 Thanks! Thanks to your first test, I found out that I misunderstood the condition. |
| Hint if WA10 | Ефанов КН114 | 1643. Attack of the Dark Fortress | 17 Aug 2020 19:59 | 4 |
Try this test: 3 3 ##$ #*# !## Answer: Impossible thank you! I am trying deal with this problem |
| Wrong Answer in task 2 | MrRobot | 1014. Product of Digits | 17 Aug 2020 19:53 | 1 |
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int Num = 0, ans = -2; cin >> Num; vector <int> fact; int n = 2; while (Num > 1) { if (n > 9) { ans = -1; break; } while (Num % n == 0) { Num /= n; fact.push_back(n); } n++; } sort(fact.begin(), fact.end()); if (n < 10 & ans != -1) { ans = 0; for (int i = 0; i < fact.size(); i++) { //ans += fact.at(i) * (i*10); cout << fact[i]; } } //cout << ans; } |