Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main(){
- freopen("DATA5.txt","r",stdin);
- freopen("OUT5.txt","w",stdout);
- const static int vec[8][3]={{1,1,1},{1,1,-1},{1,-1,1},{1,-1,-1},{-1,-1,-1},{-1,-1,1},{-1,1,-1},{-1,1,1}};
- int _,j;
- for(_=5;_--;){
- int best[8],max=-2147483647,a,b,c,d,e,f,g,h,i,u,v,t,x,cur;
- for(x=0;x<8;best[x++]=max);
- for(scanf("%i",&j);j--;){
- scanf("%i%i%i%i%i%i%i%i%i%i%i",&a,&b,&c,&d,&e,&f,&g,&h,&i,&u,&v);
- for(t=u;t<=v;++t)
- for(x=0;x<8;++x){
- cur=vec[x][0]*(a*t*t+b*t+c)+vec[x][1]*(d*t*t+e*t+f)+vec[x][2]*(g*t*t+h*t+i);
- best[x]=best[x]>cur?best[x]:cur;
- }
- }
- for(j=0;j<4;++j)
- max=best[j]+best[j|4]>max?best[j]+best[j|4]:max;
- printf("%i\n",max);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement