Update P1.cpp

Given detailed comments