Logo
(追記) (追記ここまで)

30559번 - Boat Commuter 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB118695562.500%

문제

The Bulgarian city of Nodnol runs a boat service to ferry its residents between the trendy areas in which they live and the large metallic structures in which they work on the next recession.

TFN (Transport For Nodnol) has issued $m$ travel cards (known affectionally as "Retsyo"), which are numbered from 1ドル$ to $m$. Each pier has a card terminal at which passengers are required to tap "in" when starting the trip and to tap "out" when finishing it.

As there is only one card terminal on each pier, passengers use the same device to tap in and to tap out.

Trip cost depends on the distance travelled and is determined as follows:

  • if the trip started at the pier $i$ and finished at the pier $j$ ($i \ne j$), then its cost is $|i-j|$ pounds;
  • if the trip started somewhere and was not finished with a tap out, then it costs \pounds100;
  • if the trip started and finished in the same place, then it also costs \pounds100, as it is interpreted as an attempt to game the system.

You are given a sequence of tapping events --- for each you have the pier $p_i$ and card number $c_i$ recorded. You are to determine how much the transport authority should charge each of the cards

입력

  • One line containing three integer numbers: the number of piers $n,ドル the number of travel cards $m,ドル and the number of events $k$ (2ドル \le n \le 50,ドル 1ドル \le m, k \le 10^5$).
  • $k$ further lines, each describing tap events in chronological order.
    • The $i$-th event is described by two integers $p_i$ and $c_i$ (1ドル \le p_i \le n,ドル 1ドル \le c_i \le m$).

출력

Output $m$ integers separated by spaces --- the $i$-th integer giving the total charge to be applied to the $i$-th card.

제한

예제 입력 1

3 3 5
1 1
1 2
1 2
3 1
2 3

예제 출력 1

2 100 100

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > The UK & Ireland Programming Contest > UKIEPC 2023 B번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /