Q2: Kiki's Cards Kiki is making "IHappy National Pizza Day" (Fehruary gth) cards for all of her friends. She's a bit disappointed with the cards not looking special enough, so she decides to add glitter to them to make them look more special. IHowever, she's short on glitter, so she decides to add glitter selectively. She uses a box with N- Ndivided sections to store her cards. Each section is huge and each card is small, so she can put multiple cards in a given section and they will never overlap. We model the way that she organizes the cards and adds glitter using two commands: • Command 1: 1 x y add a card to the bax in section (x, y). • Command 2: 2 x1 y1 x2 y2 Add one unit of glitter to cach of the cards in the sections from (xa. ya) to (x2. y2). IHelp Kiki determine the total number of units of glitter that she placed on the cards. Filename Your filename for this question must be a2.py. Input The first line will contain N (1 -NC- 500) and C(1<-c- 500 ), the square size of the card storage box and the number of commands. The next e lines will contain one of the commands listed above. Command 1 will contain x (1 <- xc- N) and y(1 <-yc- N), the coordinates where a new card will be added. Command 2 will conatain x1, y1, x2, and y2 (1<-x1 <- x2 <- N, 1 <- y1 <- y2 <- N), a rectangle of sections where one unit of glitter is added to all the cards. Output Output the total number of units of glitter placed on the cards. Sample Input 1 123 155 22355 131 22331 22355 Sample Output 1

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

Help. 

Qe: Kiki's Cards
Kiki is making "IHappy National Pizza Day" (Fehruary gth) cards for all of her
friends. She's a bit disappointed with the cards not looking special enough, so she
decides to add glitter to them to make them look more special. IHowever, she's
short on glitter, so she decides to add glitter selectively.
She uses a box with N* Ndivided sections to store her cards. Each section is huge
and each card is small, so she can put multiple cards in a given section and they
will never overlap. We model the way that she organizes the cards and adds
glitter using two commands:
• Command 1: 1 x y add a card to the box in section (x, y).
• Command 2: 2 x1 y1 x2 yz Add one unit of glitter to each of the cards in
the sections from (x1 y1) to (x2, y2).
IHelp Kiki determine the total number of units of glitter that she placed on the
cards
Filename
Your filename for this question must be a2.Dy.
Iпput
The first line will contain N (1 -N-500) and C (1<-c- 500 ), the square
size of the card storage box and the number of commands.
The next e lines will eontain one of the commands listed above.
Command i will contain x (1 <- x<- N) and y (1 <-y <- N), the coordinates
where a new card will be added.
Command 2 will contain x1, y1, x2, and y2 (1<- x1 <- x2 <- N, 1<= y1<= y2 <-
N), a rectangle of sections where one unit of glitter is added to all the cards.
Output
Output the total number of units of glitter placed on the cards.
Sample Input 1
56
123
155
22355
133
22333
22355
Sample Output 1
Sample Input 2
143
2112
21142
Sample Output 2
Transcribed Image Text:Qe: Kiki's Cards Kiki is making "IHappy National Pizza Day" (Fehruary gth) cards for all of her friends. She's a bit disappointed with the cards not looking special enough, so she decides to add glitter to them to make them look more special. IHowever, she's short on glitter, so she decides to add glitter selectively. She uses a box with N* Ndivided sections to store her cards. Each section is huge and each card is small, so she can put multiple cards in a given section and they will never overlap. We model the way that she organizes the cards and adds glitter using two commands: • Command 1: 1 x y add a card to the box in section (x, y). • Command 2: 2 x1 y1 x2 yz Add one unit of glitter to each of the cards in the sections from (x1 y1) to (x2, y2). IHelp Kiki determine the total number of units of glitter that she placed on the cards Filename Your filename for this question must be a2.Dy. Iпput The first line will contain N (1 -N-500) and C (1<-c- 500 ), the square size of the card storage box and the number of commands. The next e lines will eontain one of the commands listed above. Command i will contain x (1 <- x<- N) and y (1 <-y <- N), the coordinates where a new card will be added. Command 2 will contain x1, y1, x2, and y2 (1<- x1 <- x2 <- N, 1<= y1<= y2 <- N), a rectangle of sections where one unit of glitter is added to all the cards. Output Output the total number of units of glitter placed on the cards. Sample Input 1 56 123 155 22355 133 22333 22355 Sample Output 1 Sample Input 2 143 2112 21142 Sample Output 2
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY