Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Bored??

By Riaz_BSMRSTU · Limits 2s, 512 MB

“Avoid touching your face, particularly your eyes, nose or mouth to prevent the virus from entering your body.”

I know you are bored with being in quarantine. Let’s play an interesting game.

Our playground is a grid of n rows and m columns. Initially you are at P(x, y) position and there is no poison in the playground. I’ll give you q queries. In every query I’ll tell you whether to change your position to a new position or I will create an enemy on the grid at E(x, y) position and also tell you it’s range R. This enemy will poison from E(x - R, y) to E(x + R, y) and also from E(x, y - R) to E(x, y + R) positions on the grid. If any of these positions are off the grid, it’ll ignore them. If you are at any poisonous position, you will be dead instantly. In the next query you will respawn at your last position or a new position, if I have given you one.

After every query, you have to tell me whether you are dead or alive, which means your position is poisonous or not.

Input

First line of input will contain n, m and q (1 ≤ n × m, q ≤ 1e6).
Next line will contain the initial position of you, P(x, y).
Next q lines will contain two type of query.
1st type, 1 u v, change your position to the position (u, v).
2nd type, 2 u v R, I’ll create an enemy at E(u, v) position and it’s range is R(1 ≤ R ≤ 1e6).
It is guaranteed that all the given positions are on the grid.

Output

For each query, print “Opps! I’m dead” if you are dead or “I can’t be defeated” If you are alive.

Sample

InputOutput
3 3 3
1 1
2 2 2 3
2 2 1 1
1 1 3
I can’t be defeated
Opps! I’m dead
I can’t be defeated

Discussion

Statistics


11% Solution Ratio

Shahwat_Has9Earliest, 1M ago

Shahwat_Has9Fastest, 0.4s

RamprosadGLightest, 184 MB

Shahwat_Has9Shortest, 2822B

Submit

Login to submit