change the naive solution and add the script