Inflationary cosmology and the late-time accelerated expansion of the universe in nonminimal Yang-Mills-F(R) gravity and nonminimal vector-F(R) gravity