|
|
-280 19326 6488 -15295 (x2-156x+115)(x2-124x-133) 0 -18 0 81 (x-3)(x-3)(x+3)(x+3) 5 10 15 21 (x2+3)(x2+5x+7) 0 6 0 9 (x2+3)(x2+3) 0 -6 0 9 (x2-3)(x2-3) 0 10 0 9 (x2+1)(x2+9) 1 3 2 2 (x2+x+1)(x2+2) 8 22 46 55 (x+5)(x3+3x2+7x+11) -2 -8 -24 -55 (x-5)(x3+3x2+7x+11) 2 -13 -14 24 (x-1)(x+2)(x-3)(x+4) 1 0 1 0 // helps with WA 6 (x)(x3+x2+1) 1 0 -1 0 (x)(x3+x2-1) 1 0 -2 0 (x)(x-1)(x2+2x+2) May be there are good tests but they didn't help me with WA13. For 0 -18 0 81 (first test) (x-3)(x+3)(x-3)(x+3) the correct answer? Edited by author 22.01.2010 21:03 Test: 0 0 0 4 answer: (x2+2x+2)(x2-2x+2) Edited by author 05.05.2012 02:10 Maybe this one will help you: 1 1 1 0 (x)(x+1)(x2+1) It didn't help me. Can anyone say about other test case? hi i dont know why i got WA for 5 test case ... can anyone say about the test case ... Edited by author 30.12.2008 21:50 i've got WA5 too, but all tests in this forum are good PS. I find my mistake: 5 12 15 9 -> (x2+2x+3)(x2+3x+3) But now I have WA19 (( Edited by author 25.04.2012 22:08 then check this case: 0 0 0 -4 (in fact any polynomial which can be only factored into two quadratic polynomials and has negative free term will work) Edited by author 10.07.2010 00:58 If you solve this problem with a help of finding roots of the initial polynom, use long long or __int64 type in this function! This fact costed me about 5 submissions... This is the part of my code: long long PolynomValue (vector<int>PolynomCoeffs, int x0) { long long value; ... return value; } int FindRoot (vector<int> PolynomCoeffs) { ... if (!PolynomValue(PolynomCoeffs,a)) return a; ... } If I changed long long to int I would not find a root in several cases. To understand me more clearly try these tests: -20000 19998 20000 -19999 (x-1)(x-1)(x+1)(x-19999) -19998 -20000 20000 -19999 (x-19999)(x3+x2-x+1) -19999 -19999 -19999 -20000 (x+1)(x-20000)(x2+1) I guess 13th and 14th tests are something like these ones. Good luck! Edited by author 22.01.2010 21:07 Could somebody give me a hand? I had WA #14 when forgot to check the case when Polynomial = (Polynomial of 1st degree)*(Polynomial of 3rd degree) I got too many wa on it.. got it I got WA, too. Can you tell me this case ? Got it. Here is the case that helped me: 9998 -20000 0 0 Result: (x)(x)(x-2)(x+10000) Edited by author 23.12.2008 13:51 #include<iostream.h> int max1(int *x,int *y,int i,int j) { int k,m1=0,r=-1;bool p=true; for(k=i+1;k<=j&&p&&r==-1;k++) if(x[k]>=x[i]) { m1=y[k]; r=k; p=false; } if(r!=-1){ for(k=r;k<=j;k++) if(x[k]>=x[i] && y[k]>=m1) m1=y[k];
return m1+1; } return -1; } int main() { int n,a[1005],i,l[1005],max; cin>>n; for(i=1;i<=n;i++) cin>>a[i]; l[n]=1; if(a[n-1]>a[n]) l[n-1]=1; else l[n-1]=2; for(i=n-2;i>=1;i--) l[i]=max1(a,l,i,n); max=l[1]; for(i=2;i<=n;i++) if(l[i]>max) max=l[i]; cout<<max; return 0; } Please write what method or algorithm you used. Thanks. if the polynomial can be factorized to the form (x2+mx+n)*(x2+px+q),by expanding it,we can get four equation of coefficients,one of them is nq=d,notice |d|<=20000,we can enumerate its factor and check whether all the equation are meeted.the same to other forms Can we output polynoms in any order? |
|
|