BOMBER1 - Saving Planet Bomber (Easy)

no tags 

You are requested to donate your two cents to help us build a better nation:


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 NxNxN 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, <insert your name here> the greatest programmer ever to roam on Earth: Is is possible to defeat the invaders?


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.


"POSSIBLE" or "IMPOSSIBLE"  depending upon each test case.


1 <= T <= 10^6

1 <= N <= 10^7

0 <= M <= 10^16


1 0
1 1
1 2
2 1


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:
What is meant with 0<=M<=1^16?

--> Thanks for spotting the typo. Corrected! :)

Last edit: 2015-01-15 16:01:34

Added by:રચિત (Rachit)
Time limit:6s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Resource:MMO 1965