My house have hardwood floors and bedrooms have carpets just like yours. Buttercup has his own room and isn't too crazy about carpets as he is with rugs. Buttercup is 99.9% trained and never had an accident until a couple of days ago when I let him into the restroom inside my bedroom. He stood right in front of my face, peed and poop on the rug and did the same thing the next day. KEEP THEM OUT!

That's the only thing I can suggest.