Being tired of the challenging assignments given by the MCS Professors, students have collectively decided to have a roasting contest with the professors. We divide participants into two teams: students and professors. Each participant gets 500 points for their team when they roast a participant from the opposing team. Moreover, if the same participant roasts someone from the opposing team again within 10 minutes, their team gets an additional 500 points. For example, if a participant roasts twice within 10 minutes, their team gets 500+500 = 1000 points. As another example, if a participant roasts for the first time, roasts for the second time within 10 minutes, and then roasts within 10 minutes of their second roast, their team gets 500 + (500 + 500) + (500 + 500) = 2500 points. Input The first line contains the integer n (1 <= n <= 200), the number of times participants roasted each other in the contest. The second line contains the integer m1 denoting the total number of students. The third line contains the integer m2 denoting the total number of professors. Each of the following n lines contains one of the following: t_i sj pk t_i pk sj In the lines above, 0 <= t_i <= 120, 1 <= j <= m1, 1 <= k <= m2 denoting student sj, professor pk, and time t_i (in minutes). Note here that while j and k are integers, s and p are characters denoting “student” and “professor” respectively. The line t_i sj pk denotes that student j roasted professor k at time t_i, while t_i pk sj denotes that professor k roasted student j at time t_i. The numbers t_i are distinct and are in increasing order. Output One line with the total score of team students, a space, and the total score of team professors. Sample Input 1 3 3 3 1 s1 p2 2 s1 p1 3 p1 s2 Sample Output 1 1500 500

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

code in python

Being tired of the challenging assignments given by the MCS Professors, students have collectively decided to have a roasting contest with the professors. We divide participants into two teams: students and professors. Each participant gets 500 points for their team when they roast a participant from the opposing team. Moreover, if the same participant roasts someone from the opposing team again within 10 minutes, their team gets an additional 500 points.

For example, if a participant roasts twice within 10 minutes, their team gets 500+500 = 1000 points.

As another example, if a participant roasts for the first time, roasts for the second time within 10 minutes, and then roasts within 10 minutes of their second roast, their team gets 500 + (500 + 500) + (500 + 500) = 2500 points.

Input

  • The first line contains the integer n (1 <= n <= 200), the number of times participants roasted each other in the contest.
  • The second line contains the integer m1 denoting the total number of students.
  • The third line contains the integer m2 denoting the total number of professors.
  • Each of the following n lines contains one of the following:
    • t_i sj pk
    • t_i pk sj
  • In the lines above, 0 <= t_i <= 120, 1 <= j <= m1, 1 <= k <= m2 denoting student sj, professor pk, and time t_i (in minutes). Note here that while j and k are integers, s and p are characters denoting “student” and “professor” respectively. The line t_i sj pk denotes that student j roasted professor k at time t_i, while t_i pk sj denotes that professor k roasted student j at time t_i.
  • The numbers t_i are distinct and are in increasing order.

Output

One line with the total score of team students, a space, and the total score of team professors.

Sample Input 1

3

3

3

1 s1 p2

2 s1 p1

3 p1 s2

Sample Output 1

1500 500

Sample Input 2

4

4

5

1 s1 p1

3 p1 s2

4 s2 p2

5 p4 s1

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY