Cell-state-distribution –assisted threshold voltage detector for NAND flash memory