Missile Bombing
Practice
2.6 (16 votes)
Basic programming
Basics of implementation
Easy
Implementation
Problem
92% Success 3470 Attempts 30 Points 2s Time Limit 256MB Memory 1024 KB Max Code

There is N x N field on which missiles are being bombarded. Initially, all the cells in this field have 0 value. There will be M missiles bombarded on this field. ith missile will have power Pi and it will affect all the cells in region with (Ai,Bi) as top-left cornor and (Ci,Di) as bottom-right cornor. Because of missile, value of all the cells in this rectangle will get XOR with Pi.

After all the missiles have been bombarded, you have to find out values in each cell of this field.

INPUT:
First line of input will consists integer N. Next line of input will consists of M. Next M lines will contain description of missiles. ith line will contain five integers - Pi, Ai, Bi, Ci, Di.

OUTPUT:
You have to print the values in the final field. You have to print N lines, with each line containing the N integers. Integer at ith row and jth column should contain the value present at that position in the field.

CONSTRAINTS:
1 ≤ N ≤ 1000
1 ≤ M ≤ 104
1 ≤ Pi ≤ 105
1 ≤ Ai ≤ Ci ≤ N
1 ≤ Bi ≤ Di ≤ N

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
39 votes
Tags:
Basic ProgrammingBit ManipulationImplementationString Manipulation
Points:30
25 votes
Tags:
Basic ProgrammingBasics of ImplementationBit ManipulationImplementationPermutation and combination
Points:30
17 votes
Tags:
Easy