Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You should complete the function and ensure it produces the correct output against all test cases possible within the constraints highlighted. The runtime of the

You should complete the function and ensure it produces the correct output against all test cases possible within the constraints highlighted. The runtime of the program is important so it is best to use an algorithm in the code which will not timeout

image text in transcribedimage text in transcribedimage text in transcribed

Hurricane Simulation Problem Submissions Leaderboard Discussions fin Max is studying the movement of suspended particles inside a hurricane by using a simulator to predict their movements. The simulation does not track the height of the particles though, just the (, y) coordinates of the particle on the ground. The entire simulation takes place in 2-dimensions. Contest ends in 6 days Submissions: 0 Max Score: 25 Difficulty: Medium Rate This Challenge: There are n particles, and each one is given a starting position: P1, Pn in the simulator. The simulator has a simple model for movement of each particle: it is assumed that all the particles will move in a spiral like manner, although each will have its own parameters. Specifically, for each particle, Max associates an update vector (wx, 0) which will always be used to update the position of that particle throughout the entire simulation. (Each particle has its own update vector.) The rule to obtain the new position of a particle, (x, y), from its current position (x,y) using update vector (x, y) is given by the matrix computation: More ()-( : )) or more directly and y =+ In order to represent a diverse set of possible spirals, w, and v, are not necessarily integers, but in order to preserve precision, they will each be presented as rational numbers. To represent the update vector (x, y), 4 integers: On, Cd, bn, bd will be supplied, and should be interpreted that (V., wy) = (an/ad, bn/ba) In a single "step" of the simulation, all the particles are updated by their update vector to compute their new positions. Those new positions are then used as the "current" positions for the next step, which again occurs with each particle's respective update vector. After performingt steps, Max wants to know how many particles lie within the rectangle with its lower left corner at (Lxly) and its upper right corner at (Pu, wy). Particles that lie on the boundary of the rectangle should be included in the count. Help Max by writing a program to efficiently perform the steps of his simulation Input Format Line 1: 1x ly ux uy: 4 space separated integers representing the coordinates of the rectangle's bounding box Line 2: t n: 2 space separated integers representing the number of simulation steps and the number of particles, respectively Each of the following n lines contains 6 space separated integers in the format X y an ad bn bd where x, y are the coordinates of the starting point of the particle and an/ad, bn/bd are the components of its update vector Constraints 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Domain Transfer Learning With 3q Data Processing

Authors: Ahmed Atif Hussain

1st Edition

B0CQS1NSHF, 979-8869061805

More Books

Students also viewed these Databases questions

Question

=+5. What is your impression of the Carbon Principles?

Answered: 1 week ago