BOMBER1 - Saving Planet Bomber (Easy)
You are requested to donate your two cents to help us build a better nation: https://donate.aamaadmiparty.org/
Jay and Nemo are galactic wanderers. While travelling around in Bomber Nebula, they decided to spend some time in the famous Bingeling Empire. To manage their expenses, they took up an internship under Dr. Ein, the scientist assisting the Bomberman.
Unfortunately at the same time, Fiendish Bombers penetrated the defenses of the planet Bomber and have swarmed the entire empire. Consider the empire as N×N×N maze with each cell occupied by the enemy. You can also view it as a huge cube with side N.
The task of Jay and Nemo is now to guide the Bomberman to plant the bombs and destroy enemies. Because one of Dr. Ein's new invention, the Fire ability of the Bomberman’s bomb is infinite. That is, if it explodes at (x, y, z) it will destroy enemies in all the cells (*, y, z), (x, *, z) and (x, y, *). Since most of the resources of the empire are captured, they are left with only M bombs. Although being good computer scientists, they are exceptionally poor at visualising things in 3 dimensions. So they ask you,
Input
The first line contains T, the number of test cases. Each of the next T lines contains 2 space separated integers N and M, denoting the size of the maze and the count of available bombs respectively.
Output
"POSSIBLE" or "IMPOSSIBLE" depending upon each test case.
Constraints
1 <= T <= 10^6
1 <= N <= 10^7
0 <= M <= 10^16
Example
Input: 4
1 0
1 1
1 2
2 1
Output: IMPOSSIBLE
POSSIBLE
POSSIBLE
IMPOSSIBLE
Warning: Large I/O. Tested for most languages, but let me know if you are getting TLE.
hide comments
wisfaq:
2015-02-01 20:28:38
Just a little question:
|
Added by: | રચિત (Rachit) |
Date: | 2015-01-15 |
Time limit: | 6s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
Resource: | MMO 1965 |