All Tracks Basic Programming Implementation Basics of Implementation Problem

Missile Bombing
Tag(s):

Basic Programming, Basics of Implementation, Easy-Medium, Implementation

Problem
Editorial
Analytics

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

SAMPLE INPUT
3
3
3 3 1 3 2
2 2 1 2 2
3 1 1 2 3
SAMPLE OUTPUT
3 3 3
1 1 3
3 3 0
Explanation

.

Time Limit: 2.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

This Problem was Asked in

HackerEarth

Challenge Name

March Circuits '18

OTHER PROBLEMS OF THIS CHALLENGE
Notifications
View All Notifications

?