Answered step by step
Verified Expert Solution
Question
1 Approved Answer
need gour help to solve this problem using dynamic programming (python) that got correct output as shown. input: standard input output: standard output The Computer
need gour help to solve this problem using dynamic programming (python) that got correct output as shown.
input: standard input output: standard output The Computer Science department keeps getting larger, and our department has more and more undergraduate students and graduate students every year. Eventually, the department decided to partition CS 287; Colloquium in Computer Science, into two sections since otherwise no classroom is big enough for all students. Yihan is running CS 287 now. Yihan has lots of experience on running the colloquium. She categorized the speakers based on their research areas: theory. system, and Al. The students don't like to attend talks in the same category consecutively. More precisely, the students will consider this talk and the two previous talks (or fewer if there haven't been that many), and: - If they are in same category, students will only pay attention to the talk for 20 minutes. - If they are from two categories, students will pay attention to the talk for 40 minutes. - If they are all from three different categaries, students will pay aftention to the talk for the entire 60 minutes. Yihan has contacted n prominent computer scientists to give the talks. Of course, the speakers are busy, so they have committed s certain day to give the talk. Yihan knows the order, and her task is to determine which speaker should go to which section. The speakers do not like to give the same talk twice, so Yihan can only assign himvher to one of the sections. Input The first line contains an integer n(1n100,000). The second line contains a string consisting of n characters, indicating the speakers research areas in the order their taiks. Each character will be one of the uppercase letters ' T ' (for theory). ' S ' (for systern) or ' A ' (for A ). Output The output contains only one number, the total time (in minutes) that the students will pay attention to for both sections. The two sections can have different numbers of speakers Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started