Equal Schedules

시간 제한1초메모리 제한1024 MB

요약
두 온콜 일정이 주어질 때 각 팀원의 총 온콜 시간을 계산하고, 이름순으로 인원별 차이를 출력한다.
난이도

쉬움10점 중 3점

유형
해시맵, 시뮬레이션, 구현, 정렬
정답자
아직 제출이 없습니다

문제

You are one of the people on-call for a high-availability service that offers users to solve programming tasks. As an organized team, you have an on-call schedule specifying who is responsible for the service at which time. A colleague sends you a new schedule, and you want to make sure that everyone has the same amount of on-call time as before, or print any differences.

The on-call schedule is specified with lines of form s_ie_it_is\_ie\_it\_i, where s_is\_i and e_ie\_i represent the start and end offsets of the on-call shift for a teammate t_it\_i from some start hour.

Given a sample schedule

0 7 jan
7 14 tomaz
14 20 jure
20 24 jan
24 25 tomaz
25 26 jure

we can see that jan is on-call for the first 7 hours (hour 0, 1, 2, 3, 4, 5, and 6), tomaz for next 7, ... In total, jan is on-call for 11 hours, tomaz for 8 and jure for 7.

입력

The input contains two schedules separated by a horizontal line ------. Each schedule contains one or more lines of form s_ie_it_is\_ie\_i t\_i, where integers s_is\_i and e_ie\_i specify that teammate t_it\_i is on-call for hours from s_is\_i up to and excluding e_ie\_i. A final line ====== is printed after the second schedule.

출력

Output the differences between two schedules, in form t_i±!d_it\_i \pm\\! d\_i, where d_id\_i is the difference between the second and the first schedule for the teammate t_it\_i. The output should be sorted alphabetically by teammates' names and teammates with no differences should be omitted, otherwise the difference should be printed with a + or a - sign. If no differences are found, print "No differences found." (without the quotes).

제한

For each schedule, the following holds:

  • s_1=0s\_1 = 0
  • s_i<e_is\_i < e\_i
  • s_i+1=e_is\_{i+1} = e\_i
  • e_i≤1000e\_i \leq 1000
  • Name t_it\_i will consist of lowercase letters from the English alphabet.
  • 3≤∣t_i∣≤203 \leq |t\_i| \leq 20

예제3

  1. 예제 1

    입력
    0 7 jan
    7 14 tomaz
    14 20 jure
    20 24 jan
    24 25 tomaz
    25 26 jure
    ------
    0 9 tomaz
    9 20 jan
    20 26 jure
    ======
    
    예상 출력
    jure -1
    tomaz +1
    
  2. 예제 2

    입력
    0 7 nino
    7 14 bgs
    14 21 ines
    ------
    0 7 ines
    7 14 nino
    14 21 bgs
    ======
    
    예상 출력
    No differences found.
    
  3. 예제 3

    입력
    0 3 vid
    3 6 maks
    6 9 janez
    ------
    0 1 vid
    1 2 vid
    2 3 vid
    3 4 maks
    4 5 maks
    5 6 maks
    6 7 janez
    7 8 janez
    ======
    
    예상 출력
    janez -1