Python3 O(n) in 52ms with explanation
The key observation is that if such a division is possible, then the three parts has to contain equal numbers of 1s.  More details are in the comments.\n\ndef t
The key observation is that if such a division is possible, then the three parts has to contain equal numbers of 1s.  More details are in the comments.\n```\ndef threeEqualParts(self, A):\n        """\n        :type A: List[int]\n        :rtype: List[int]\n        """\n        one_count=A.count(1)\n        if one_count==0:\n            return [0,len(A)-1]\n        if one_count%3!=0: return [-1,-1]\n\t\t\t\t# waive some impossible instances\n        i=0\n        count=0\n        while count<one_count//3:\n            if A[i]==1:\n                count+=1\n            i+=1\n        #count==1_count//3 and A[:i] contains 1/3 of total 1\'s \n        j=i\n        while count>0:\n            if A[j]==1:\n                count-=1\n            j+=1\n        #this takes O(n) time, then final decide where to set i and j such that they can be compared within O(n) time \n        tail_count=0#counting how many zeros there are at the tail, and later the number of zeros at the tail of each part have to equal\n        pointer=-1\n        while A[pointer]==0:\n            tail_count+=1\n            pointer-=1\n        for k in range(tail_count):\n            if A[i+k]==1 or A[j+k]==1: return [-1,-1] #If the number of zeros at tails are not equal, then there is a mistake\n        i+=tail_count\n        j+=tail_count \n        a,b,c=0,i,j\n        while A[a]==0:\n            a+=1\n        while A[b]==0:\n            b+=1\n        while A[c]==0:\n            c+=1\n        if A[a:i]==A[b:j] and A[b:j]==A[c:]:\n            print (i,j)\n            return [i-1,j]\n        return [-1,-1]\n```\n
[]