a guest Jan 20th, 2012 35 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python
  2. inp=file("DATA5.txt")
  3. out=file("OUT5.txt","w")
  4. vec=[(1,1,1),(1,1,-1),(1,-1,1),(1,-1,-1),(-1,-1,-1),(-1,-1,1),(-1,1,-1),(-1,1,1)]
  5. for _ in xrange(5):
  6.         best=[-2147483649L]*8
  7.         for _ in xrange(int(inp.readline())):
  8.                 [a,b,c,d,e,f,g,h,i,u,v]=map(int,inp.readline().split())
  9.                 for x in xrange(8):
  10.                         for t in (u,v,min(u,max(v,int((1-(vec[x][0]*b+vec[x][1]*e+vec[x][2]*h)/(vec[x][0]*a+vec[x][1]*d+vec[x][2]*g))/2)))):
  11.                                 best[x]=max(best[x],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))
  12.         out.write(str(max(map(lambda i:best[i]+best[i+4],xrange(4))))+"\n")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand