A robot is placed at the origin of a 2D coordinate plane (.e. position (0,0)). The...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
A robot is placed at the origin of a 2D coordinate plane (.e. position (0,0)). The robot is given a string S containing characters in (N. E. S. W) as its instructions. For each character from the beginning of the string. the robot has to move 1 unit to the following direction: . If the character is 1, the robot has to move 1 unit to the positive -axis direction. . If the character is E, the robot has to move 1 unit to the positive z-axis direction. . If the character is 5, the robot has to move 1 unit to the negative -axis direction. . If the character is w, the robot has to move 1 unit to the negative -axis direction. You do not know the string S. However, you know another string P that is an anagram of S (ie. P has the same number of N, E., S, w characters as S). You also have M data points: T.X₁ and ₁. For all , you know that the robot is at position (X,Y) after moving exactly 7, units. You want to know the number of possible string S that satisfies all the information you know. GUIDES: USE C PROGRAMMING LANGUAGE Input Input begins with a line containing two integers: NM (1≤M≤N≤ 400000) representing the number of characters in P and the number of data points, respectively. The next line contains a string P containing N characters in the set (N.E.S.W). The next lines each contains three integers: T, X, Y, (1 ≤ T ≤N; -T.≤X..Y. ST.) representing the data points. It is guaranteed that 7. A robot is placed at the origin of a 2D coordinate plane (.e. position (0,0)). The robot is given a string S containing characters in (N. E. S. W) as its instructions. For each character from the beginning of the string. the robot has to move 1 unit to the following direction: . If the character is 1, the robot has to move 1 unit to the positive -axis direction. . If the character is E, the robot has to move 1 unit to the positive z-axis direction. . If the character is 5, the robot has to move 1 unit to the negative -axis direction. . If the character is w, the robot has to move 1 unit to the negative -axis direction. You do not know the string S. However, you know another string P that is an anagram of S (ie. P has the same number of N, E., S, w characters as S). You also have M data points: T.X₁ and ₁. For all , you know that the robot is at position (X,Y) after moving exactly 7, units. You want to know the number of possible string S that satisfies all the information you know. GUIDES: USE C PROGRAMMING LANGUAGE Input Input begins with a line containing two integers: NM (1≤M≤N≤ 400000) representing the number of characters in P and the number of data points, respectively. The next line contains a string P containing N characters in the set (N.E.S.W). The next lines each contains three integers: T, X, Y, (1 ≤ T ≤N; -T.≤X..Y. ST.) representing the data points. It is guaranteed that 7.
Expert Answer:
Answer rating: 100% (QA)
To solve this problem we can iterate through each character in string P and check if it satisfies th... View the full answer
Related Book For
Physics
ISBN: 978-0077339685
2nd edition
Authors: Alan Giambattista, Betty Richardson, Robert Richardson
Posted Date:
Students also viewed these programming questions
-
A small magnet placed at the origin produces B = 0.5az, mWb/m2 at(10, 0, 0). Find B at (a) (0, 3, 0) (b) (3, 4, 0) (c) (1, 1, 1)
-
A force acts at the origin of a coordinate system in a direction defined by the angles x = 43.2 and z = 83.8. Knowing that the y component of the force is 50 lb, determine (a) The angle y, (b) The...
-
A force acts at the origin of a coordinate system in a direction defined by the angles x= 69.3 and z = 57.9. Knowing that the y component of the force is -174.0 lb, determine (a) The angle y, (b) The...
-
A molecule with the molecular formula C11H12N2O2 (relative molecular mass = 204.23) crystallized to form monoclinic crystals with a=18.899 , b=5.7445 , and c=9.309 , with =101.776. The crystal...
-
Rita and Rick Redding own and operate a tomato grove. After preparing the following income statement, Rita believes they should have offered the No. 3 tomatoes to the public for free and saved...
-
Green Lawns provides a lawn fertilizer and weed control service. The company is adding a special aeration treatment as a low-cost extra service option that it hopes will help attract new customers....
-
Yale Corporation issued to Zap Corporation \(\$ 60,000,8 \%\) (cash interest payable semiannually on June 30 and December 31) 10 -year bonds dated and sold on January 1, 2020. Assume that the company...
-
Holiday Fruit Company buys oranges and processes them into gift fruit baskets and fresh juice. The company grades the fruit it buys on a scale from 1 (lowest quality) to 5 (highest quality). The...
-
Thome and Crede, CPAs, are preparing their service revenue (sales) budget for the coming year (2020). The practice is divided into three departments: auditing, tax, and consulting, Billable hours for...
-
Consider the unadjusted trial balance of Burrows Landscaping at December 31, 2023, and the related month-end adjustment data: The following adjustments need to be made on December 31 before the...
-
You are planning to chargers from China The annual charger demand is 12,000 chargers The setup/order cost is $1,000 per order The holding Cost per unit per year expressed as a percent of price p is...
-
Discuss the concepts of the different types of capital maintenance in line with international public sector accounting standards.
-
What is the function of the following forearm muscles; extensorcarpi ulnaris- flexor carpi ulnaris- Flexion and adduction at thewrist. flexor carpi radialis- Flexes wrist extensor carpi...
-
Law Briefly describe the law. Whose rights are covered by the law? Who in an organization is responsible for ensuring compliance with the law? Family Educational Rights and Privacy Act (FERPA) A law...
-
Goats are foregut fermenters and one common dietary supplementthat is recommended to them is baking soda (sodium bicarbonate, pH8). Why does this make sense as a supplement for these animals?
-
Consider the following situations. In each case, do we have an asset or liability within the definitions given by the Framework? Give reasons for your answer. (a) Pat Co has purchased a patent for...
-
Hi my question is: Calculate the Cash Conversion Cycle (CCC) for each of the two companies in 2019 and 2020. Using your answer, analyse the efficiency of each of the two companies in managing their...
-
Coastal Refining Company operates a refinery with a distillation capacity of 12,000 barrels per day. As a new member of Coastal's management team, you have been given the task of developing a...
-
An IV is connected to a patient's vein. The blood pressure in the vein has a gauge pressure of 12 mm Hg. At least how far above the vein must the IV bag be hung in order for fluid to flow into the...
-
Deep-water waves are dispersive (their wave speed depends on the wavelength). The restoring force is provided by gravity. Using dimensional analysis, find out how the speed of deep-water waves...
-
A baseball batting coach emphasizes the importance of "follow-through" when a batter is trying for a home run. The coach explains that the follow-through keeps the bat in contact with the ball for a...
-
8. A. B. Rains worked as a broker for the Joseph Denunzio Fruit Co. Raymond Crane offered to sell Rains nine carloads of emperor grapes. Rains accepted the offer on behalf of Denunzio. Later, Rains...
-
7. CPA QUESTION A principal will not be liable to a third party for a tort committed by an agent: a. Unless the principal instructed the agent to commit the tort b. Unless the tort was committed...
-
10. YOU BE THE JUDGE WRITING PROBLEM Sara Kearns went to an auction at Christie's to bid on a tapestry for her employer, Nardin Fine Arts Gallery. The good news is that she purchased a Dufy tapestry...
Study smarter with the SolutionInn App