City of Atlantis

Limits: 3s, 1.0 GB

Have you ever heard of The Atlantis City? It’s a Greek mythological city. Its existence doesn’t matter to us anymore. But last night I had a nightmare. Poseidon, The King of Great Atlantis City, came to me and gave me a problem. Now you must write a program that can solve the Poseidon problem.

This is a companion discussion topic for the original entry at