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...
-
The Sarbanes-Oxley Act of 2002 created the Public Company Accounting Oversight Board. Explain the major responsibilities of this board.
-
Ken Ham started his own consulting firm, Hambone Consulting, on May 1, 2010. The trial balance at May 31 is as follows. In addition to those accounts listed on the trial balance, the chart of...
-
Political expectations, inflation, and unemployment Consider a country with two political parties, Democrats and Republicans. Democrats care more about unemployment than Republicans, and Republicans...
-
Lucent Manufacturing Company makes a product that it sells for $75 per unit. The company incurs variable manufacturing costs of $30 per unit. Variable selling expenses are $9 per unit, annual fixed...
-
Consider the two classes represented in the following UML diagram. Implement the two classes as explained below. YouTube Channel -owner: String -nbOfVideos: int -videos: Video[] +YouTubeChannel...
-
Aaron, Deanne, and Keon formed the Blue Bell General Partnership at the beginning of the current year. Aaron and Deanne each contributed $110,000 and Keon transferred an acre of undeveloped land to...
-
Martin Matthew runs a mobile parts and supplies store. During the 2019-2020 financial year, this store has the following transactions. Ignore GST. Required: Using a perpetual system and the moving...
-
Read and research about networking skills related to business. Discuss what you believe to be your 2 top networking skills. What skills would you like to acquire or enhance to help your business...
-
Prefer to discuss the company as a whole Reference it to GLOBAL MARKETING if you can THE COMPANY: AMAZON INC identify the influencing environments 6E's economic technological political/legal -...
-
Three point charges of equal magnitude q are located at x = 2, y = +2, and y = -2. Find the coordinates of a fourth positive charge, also of magnitude q, that will yield a zero net electric field at...
-
Discuss whether the type of managed care you would choose for your clinic would change if you had to be a part of the same type of insurance. Explain your reasoning.
-
1. Discuss the "Five Myths" about business ethics. Does individuals agree or disagree with each and why? 2. Compare and contrast the similarities and differences in the way leadership has been...
-
Your company may introduce a new line of tennis shoes. You have been given the following projections: sales = 35,000 units at $40 per unit; variable costs = $25 per unit; fixed costs = $125,000 per...
-
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...
-
Many hotel jobs are inherently dead end; for example, maids, laundry workers, and valets, either have no great aspirations to move up, or are just using these jobs temporarily, for instance, to help...
-
Using what you learned in this chapter of Dessler Human Resource Management, build on the companys new system by recommending two more specific career development activities the hotel should...
-
Should other employees (cleaner/spotters, counter people) be put on a similar plan? Why or why not? If so, how exactly?
Study smarter with the SolutionInn App