|
|
#include <stdio.h> int p,t,n,m; int main() { scanf("%d%d%d%d",&p,&t,&n,&m); if (p<2 || p>10000 || t<2 || t>200 || (t&1) || n<1 || n>10 || m<1 || m>100) return 1/(p-p); return 0; } This program gets "Crash (integer division by zero)" at test #1. http://acm.timus.ru/status.aspx?space=1&num=1526You are right, m = 0 in the 1st test. This limitation in the problem statement is fixed now. But there is a division by zero in his code! Sandro, why did you delete my post? Because the solution of Yermak is a input validator. If the system verdict on some test is Crash (division by zero), then this test is incorrect. If the test is correct, system verdict should be Wrong Answer. Sandro, look at this line of his code! There is a division by zero if condition is true, because p-p = 0! if (p<2 || p>10000 || t<2 || t>200 || (t&1) || n<1 || n>10 || m<1 || m>100) return 1/(p-p); Edited by author 13.08.2012 11:55 Captain Obvious to the rescue! Noob, oh, i understand. Edited by author 14.08.2012 00:04 Or is this possible: bring 1, bring 2, take 2 away, bring 3, take 3 away, take 1 away? Or what is the answer for 9999 6 1 0 ? 4 or 5? After careful analysis of second sample I concluded that waiter could take away any number of plates. i did just dp. [bitmask][no of iter until roll back][height left] somebody help please. thanks in advance i and j can be eqal! This made my get a WA#6. Here are some interesting tests: Input: 1000 4 2 1 1 1 Output: 7 Input: 1000 4 1 1 1 1 Output: 1 How do you think, is 1000*100*100*10 - solution quite normal? Or is there a faster solution? I've got AC with time above, but it take me some time to fit TL. My solution has same complexity, but it works fairly fast. It's interesting to recognize professional secrets. I think,that here 1000=1024=2^10 and means DP on subsets of admissible plates. First 100- is number of ways to remove first stage of fiesta:when first stack of plates go up and disappeare after. Second 100- Dp when calculating number of ways to build the fist stack of plates as a function of it's height<=100. And final 10- innerst loop op Dp then one of 10 plates may be pushed to head of stack(stack here not programming but fiesta's term) Edited by author 26.08.2007 10:38 Edited by author 26.08.2007 10:38 Actually it's not quite 1000*10 if optimized properly. Either 1000 decreases by considering only dishes within uncommon pairs or 10 decreases according to number of dishes affectable by current value of 2^10 loop. It even can become 2000 or smth like that. Edited by author 06.08.2008 02:43 sorry..... Edited by author 15.03.2007 12:35 |
|
|