d- and p-Wave superconductivity mediated by spin fluctuations in two- and three-dimensional single-band repulsive Hubbard model