fork download
  1. f=lambda M,t=1:max(f(M[1:]),f(zip(*M)[::-1],t+1))if`t/3`in`M`else`M`.count(`t`)
  2.  
  3. print f([(0,)])
  4. print f([(1,)])
  5. print f([(0, 0), (0, 0)])
  6. print f([(0, 1), (1, 0)])
  7. print f([(0, 1), (1, 1)])
  8. print f([(1, 1, 1), (0, 1, 0), (1, 1, 1)])
  9. print f([(1, 0, 1), (0, 1, 1), (1, 1, 1)])
  10. print f([(0, 1, 1, 1), (1, 1, 1, 0), (1, 1, 0, 0)])
  11. print f([(1, 1, 1, 1, 1, 1, 1), (1, 1, 1, 0, 1, 1, 1), (1, 0, 1, 1, 1, 0, 1)])
Success #stdin #stdout 0.7s 9016KB
stdin
Standard input is empty
stdout
0
1
0
1
2
3
4
4
7