This may get confusing, but it does work.
For QP
If: [a1(b1-a1)+c1] = [a2((45-b1)-a2)+c2]
Then: [a1(b1-a1)+c1] + [a2((45-b1)-a2)+c2] = Both alliance's score
For EP
If: [a1(b1-a1)+c1] = [a2((45-b1)-a2)+c2] For Match one and Match two then addition matches are played until [a1(b1-a1)+c1] > [a2((45-b1)-a2)+c2] or [a1(b1-a1)+c1] < [a2((45-b1)-a2)+c2].
Also for EP (1 in front of a term means match 1 and 2 in front of a term means match 2)
If: [1a1(1b1-1a1)+1c1] > [1a2((45-1b1)-1a2)+1c2]
Then: [1a1(1b1-1a1)+1c1] + 2*[1a2((45-1b1-1a2)+1c2] = your winning score for match 1
If: [1a1(1b1-1a1)+1c1] < [1a2((45-1b1)-1a2)+1c2]
Then: [1a1(1b1-1a1)+1c1] = your losing score for match 1
This is true for match two as well.
So,
If: [1a1(1b1-1a1)+1c1] > [1a2((45-1b1)-1a2)+1c2] and [2a1(2b1-2a1)+2c1] > [2a2((45-2b1)-2a2)+2c2]
Then: You advance
If: [1a1(1b1-1a1)+1c1] < [1a2((45-1b1)-1a2)+1c2] and [2a1(2b1-2a1)+2c1] < [2a2((45-2b1)-2a2)+2c2
Then: You drop out
If: [1a1(1b1-1a1)+1c1] > [1a2((45-1b1)-1a2)+1c2] and [1a1(1b1-1a1)+1c1] < [1a2((45-1b1)-1a2)+1c2] and [1a1(1b1-1a1)+1c1] + 2*[1a2((45-1b1-1a2)+1c2] + [2a1(2b1-2a1)+2c1] > [1a2(1b2-1a2)+1c2] + [2a2(2b2-2a2)+2c2] + 2*[2a2((45-2b2-2a2)+2c2]
Then: You advance
If: [1a1(1b1-1a1)+1c1] > [1a2((45-1b1)-1a2)+1c2] and [1a1(1b1-1a1)+1c1] < [1a2((45-1b1)-1a2)+1c2] and [1a1(1b1-1a1)+1c1] + 2*[1a2((45-1b1-1a2)+1c2] + [2a1(2b1-2a1)+2c1] < [1a2(1b2-1a2)+1c2] + [2a2(2b2-2a2)+2c2] + 2*[2a2((45-2b2-2a2)+2c2]
Then: You drop out
If: [1a1(1b1-1a1)+1c1] < [1a2((45-1b1)-1a2)+1c2] and [1a1(1b1-1a1)+1c1] > [1a2((45-1b1)-1a2)+1c2] and [1a1(1b1-1a1)+1c1] + [2a1(2b1-2a1)+2c1] + 2*[2a1((45-2b1-2a1)+2c1] > [1a2(1b2-1a2)+1c2] + 2*[1a2((45-1b2-1a2)+1c2] + [2a2(2b2-2a2)+2c2]
Then: You advance
If: [1a1(1b1-1a1)+1c1] < [1a2((45-1b1)-1a2)+1c2] and [1a1(1b1-1a1)+1c1] > [1a2((45-1b1)-1a2)+1c2] and [1a1(1b1-1a1)+1c1] + [2a1(2b1-2a1)+2c1] + 2*[2a1((45-2b1-2a1)+2c1] < [1a2(1b2-1a2)+1c2] + 2*[1a2((45-1b2-1a2)+1c2] + [2a2(2b2-2a2)+2c2]
Then: You drop out
Like I said, it should work, maybe I am incorrect some where will a variable tho.
O, I forgot to do the situation where if either one of the matches are tied. You can assume what happens then tho :
