The present invention provides a compound of Formula (I): wherein the variables Z, n, Y and p are as defined herein, and pharmaceutically acceptable salts thereof, which can inhibit the activity of poly (ADP-ribose)polymerases, and pharmaceutical compositions comprising the same.