def firstWillWinNormalCase(self, values):
        n = len(values)
        if n == 1:
            return True

        SZ = 4
        F = [[[0 for _ in xrange(SZ)] for _ in xrange(SZ)] for _ in xrange(2)]
        s = [0 for _ in xrange(n+1)]
        for i in xrange(1, n+1):
            s[i] = s[i-1]+values[i-1]

        for i in xrange(n-2, -1, -1):
            for j in xrange(i+1, n):
                for p in xrange(2):
                    if j == i+1:
                        a = values[i+1]
                        b = values[i]
                    else:
                        a = F[1^p][(i+1)%SZ][j%SZ]
                        b = F[1^p][i%SZ][(j-1)%SZ]

                    F[p][i%SZ][j%SZ] = max(
                        values[i]+s[j+1]-s[i+1]-a,
                        values[j]+s[j]-s[i]-b
                    )

        return F[0][0][(n-1)%SZ] > min(F[1][0][(n-2)%SZ], F[1][1][(n-1)%SZ])
optimize data structure
dataset/ETHPy150Open algorhythms/LintCode/Coins in a Line III.py/Solution.firstWillWinNormalCase