How much is it flooded?
A Noah-style flood went over the highest mountains. Ignoring the scientific plausibility (which is easy-enough to do when you have either religion or a science fiction/fantasy author involved), this is a LOT of water. A flood of a couple hundred feet is enough to do a lot of damage, but is not nearly as bad (as explained below) as a Noah-style flood. This is essentially a Noah-style flood, whether the tops of a few mountains are accessible (which is better than nothing) or not.
According to the Wikipedia list of the highest mountains on Earth, there are 108 > 23,000 feet. That is more than "a few" but is good enough to work with. 23,000 feet/5 years ~ 12 feet per day of rise in sea level. That is a LOT. Assuming we have little additional warning, that means coastal cities have problems within a few days.
So let's assume, for the moment, that there is a little bit of warning, just to give some people time to stockpile supplies and quickly put together a few ships. But not decades like my original answer.
Underwater cities won't work without a huge amount of time to prepare. Water pressure increases by 1 atmosphere every 34 feet. It is possible to live at the natural pressure a few hundred feet below the surface, with enough preparation - and being extremely careful (and slow moving) coming back up. But with only the tops of the highest mountains above water, there will be relatively little land near the surface to build on. That means taking existing cities and enclosing them to be livable at a normal pressure. That is not too hard for 2 or 3 atmospheres. The highest cities are currently ~ 16,000 feet above sea level. 23,000 - 16,000 = 7,000 feet. 7,000/34 = 205 atmospheres. Not going to happen. So that limits any practical survival to the surface of the ocean.
Start with big ships
If you start with an US aircraft carrier (which has been used in many science fiction novels that I have read) then you have a nice big platform for building on and a nuclear power plant to supply power for a while.
If you start with a cruise ship then you have living quarters for thousands of people with all the amenities.
Take either (or both) of these and link up plenty of smaller ships, boats, rafts, etc. and you can safely house thousands of people. Add a hospital ship and you have medical taken care of, at least for a little while.
Container ships can be a huge help. They aren't great for living quarters, but a ship with thousands of 40-foot containers can hold enough supplies - food, medicine, clothing, etc. - to help people survive for a while. But they won't last forever.
Problem # 1 - Fuel
Fuel is a BIG problem. If you have a global flood, you can't drill for oil, dig for coal - and even if you can, a refinery takes above-water facilities that you simply don't have. Solar energy isn't nearly enough because you don't have large areas for solar panels or other collectors - in fact, you are likely building up, not out, in general - look at a typical cruise ship for an example.
Nuclear power from your aircraft carriers will help for few years, but it is limited in both time & capacity.
If there is enough planning from the nuclear-capable countries - e.g., US, Russia, France, Japan - then you can build a bunch of naval reactors (i.e., like the US aircraft carriers & submarines use) and mine/process as much uranium as possible to, hopefully, provide power for a group of large ships for several decades. If not, then Fuel will be a big problem. While it may be possible to extract uranium or thorium from seawater and use that to power your floating cities, setting up a floating system to do all of that will take time to develop & test that you just don't have.
Problem # 2: Food
I hope everyone likes fish & seaweed. Every little boat becomes a fishing boat. Every day they spread out to the surrounding area and throw out their nets and collect what they can. At the end of the day they head back to the mother ship and have fresh fish for dinner. Everything else can be stockpiled but really won't last long. A fish/seaweed diet is likely to be low in a number of vital vitamins and minerals - think Vitamin C/scurvy - so a stockpile of key vitamins and other nutrients will be critical.
Greenhouses, green roofs, etc. can help some by providing a place to grow fruits & vegetables, but only the top level of your ships will work for that, and doing so is not compatible with covering the top of everything with solar cells to produce electricity - some tough tradeoffs will be needed.
Problem # 3: Security
Pirates will be everywhere. Only the largest countries or the largest private organizations will have self-sufficient (though all time-limited) "cities". Plenty of people will grab their guns and their boats and when they get hungry...watch out. A destroyer equipped for battle can easily stop enemy boats. An aircraft carrier or cruise ship teeming with refugees has a harder time, plus the big guns will run out of ammunition before the pirates do. No home base to call for support.
Problem # 4: Everything Else!
Supplies of everything will be limited. No factories producing clothing and electronics in China. No factories producing medicine in the US. Unlike many other global disaster scenarios, no scavenging of supplies from abandoned cities.
End result - doomed!
Too many variables to say for sure, but my guess is that:
- Largest "cities", on the order of 10,000 - 20,000 people - decimated within 10 years due to lack of fuel, food and supplies.
- Smaller "towns", on the order of 100 - 1,000 people - most will not last long at all, but some (private "towns" funded by billionaires) will be well planned, well stocked and last for decades if disease doesn't kill them off.
- Small groups - pirates, families, etc. - < 100 people - will have big problems surviving more than a few years due to lack of infrastructure (medical support, mechanical repairs, etc.)
In short, doomed.