In a previous apartment I put down some sheets of 1/2" tongue and groove OSB over the carpet, then I screwed down a layer of masonite with the seams offset from the seams in the OSB. It was a bit overkill, but made a nice and solid surface that still floated over the carpet, and he room was like 8'x11', so it worked out quite nicely. I taped up all of the seams and the perimeter and then used an outdoor-grade oil based paint. Held up quite well for a number of years, and total cost was like a hundred bucks.
My current home lab is in a basement with some nice but horrifically installed marble tile, and there was no way I was going to get full 4x8 sheets of plywood down the stairs, so I laid down a couple of layers of ~5mm foam underlayment, then some of the cheapest interlocking composite flooring I could find. The cheap planking follows the topography of the floor better than plywood would have, but still evens it out well enough that my chair rolls around easily.
EDIT: If I were dealing with carpet again I would probably go with some 5mm Lauan or similar underlayment plywood and then the interlocking planks.
Also It's worth noting that some places require that multi-family dwellings have a certain percentage of the floor carpeted for noise reasons, so covering the carpet with a hard surface might run you afoul of that. Depends on how stringent the landlord/local authorities are.