PYTHON PROGRAMMING!! EXTRA CONSTRAINT: MAKE SURE THAT THE CODE ACCEPTS THE INPUT ON THE IMAGE AND OUTPUTS THE RESULT ON THE IMAGE AS WELL You find yourself in a top-secret mission to infiltrate and disable the nuclear missile silos of a terrorist organization threatening to destroy any country that refuses to surrender. Fortunately, an ally double agent was able to successfully hijack the launch system used by the terrorists. However, in order to not get found out, they could not disable the system outright but they were able to infect the system with an undetectable virus that stops all processes of the system was activated. Through a secure line, the double agent gives you the instructions in order to activate the virus and stop all missiles from firing: In the trash can nearest the main computer, you should be able to get a crumpled piece of paper with a grid of random numbers printed onto it. You will know that it is the right piece of paper if there are the same number of rows and columns in the grid. Find the sequence of consecutive rows where the difference of the sum of the elements of the odd-numbered rows from the sum of the elements in the even-numbered rows are maximum. Get the first number in the first row of the sequence, then the second element of the second row in the sequence, and so on until the corresponding element in the last row in the sequence. Enter these numbers on the main computer and run away as fast as you can. Being fast is very important as it will minimize your chances of getting caught. Luckily, you can bring with you on the mission a small computer which can run a program to look for the palindromic number for you. Good luck on your mission! FORMAT FOR THE INPUT The first line of the input is an integer, n, where n is the number of rows and columns of the grid. Then there will be n succeeding lines with each with n digits separated by spaces. RESTRICTIONS 0 <= n <= 2000 0 <= d <= 1000 for each digit d in the grid It is guaranteed that each test case would only have one quartet that satisfies the conditions needed. Your solution should have a log-linear (O(nlogn) worst-case time complexity. You are allowed to have at most one loop with O(n^2) time. The rest of your program/functions should all be below or equal to O(nlogn). FORMAT FOR THE INPUT One line for each number in the activation code.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

PYTHON PROGRAMMING!!

EXTRA CONSTRAINT: MAKE SURE THAT THE CODE ACCEPTS THE INPUT ON THE IMAGE AND OUTPUTS THE RESULT ON THE IMAGE AS WELL

You find yourself in a top-secret mission to infiltrate and disable the nuclear missile silos of a terrorist organization threatening to destroy any country that refuses to surrender. Fortunately, an ally double agent was able to successfully hijack the launch system used by the terrorists. However, in order to not get found out, they could not disable the system outright but they were able to infect the system with an undetectable virus that stops all processes of the system was activated.

Through a secure line, the double agent gives you the instructions in order to activate the virus and stop all missiles from firing:

  1. In the trash can nearest the main computer, you should be able to get a crumpled piece of paper with a grid of random numbers printed onto it. You will know that it is the right piece of paper if there are the same number of rows and columns in the grid.
  2. Find the sequence of consecutive rows where the difference of the sum of the elements of the odd-numbered rows from the sum of the elements in the even-numbered rows are maximum.
  3. Get the first number in the first row of the sequence, then the second element of the second row in the sequence, and so on until the corresponding element in the last row in the sequence.
  4. Enter these numbers on the main computer and run away as fast as you can.

Being fast is very important as it will minimize your chances of getting caught. Luckily, you can bring with you on the mission a small computer which can run a program to look for the palindromic number for you. Good luck on your mission!

FORMAT FOR THE INPUT

The first line of the input is an integer, n, where n is the number of rows and columns of the grid.

Then there will be n succeeding lines with each with n digits separated by spaces.

RESTRICTIONS

0 <= n <= 2000

0 <= d <= 1000 for each digit d in the grid

It is guaranteed that each test case would only have one quartet that satisfies the conditions needed.

Your solution should have a log-linear (O(nlogn) worst-case time complexity.

You are allowed to have at most one loop with O(n^2) time. The rest of your program/functions should all be below or equal to O(nlogn).

FORMAT FOR THE INPUT

One line for each number in the activation code.

Sample Input 1
10
90
19
45
88
18
32
12
89
27
36
68
24
96
57
80
73
45
11
56
73
95
39
21
8
83
93
65
56
85
34
64 96 23 3
19
7.
12
59
67
40
15
46
44
50
58
66
33
42
20
67
3 95 75 19
34
34
98
65
30
9
49 10 55 54
62
98
7
25
97
20
9
74
75
100
79
100
70
71
2
35
47
58
79
94
41
6
31
94
95
34
21
58
17
2
78
12
27
Sample Output 1
Transcribed Image Text:Sample Input 1 10 90 19 45 88 18 32 12 89 27 36 68 24 96 57 80 73 45 11 56 73 95 39 21 8 83 93 65 56 85 34 64 96 23 3 19 7. 12 59 67 40 15 46 44 50 58 66 33 42 20 67 3 95 75 19 34 34 98 65 30 9 49 10 55 54 62 98 7 25 97 20 9 74 75 100 79 100 70 71 2 35 47 58 79 94 41 6 31 94 95 34 21 58 17 2 78 12 27 Sample Output 1
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Running Time of Application
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education