cky algorithm optimized