포럼
문제 ICPC00210

J. Justice Served

설명

You finally managed to produce the ultimate stroopwafel with just the right number of squares on it. After the hard work, you left the stroopwafel unattended for a few seconds to get yourself a hot drink. Full of anticipation for your delicious treat, you came back just to see that your stroopwafel was gone! Even though you were only away for a short time, someone used the opportunity to steal it.

You looked at the security recordings and saw a total of \(n\) suspects that had been in the room where you left your stroopwafel, each entering and leaving the room exactly once. After seeing this, you already had a good idea who took it since your archrival Rob – who has some background in robberies – was among the suspects. But you wanted to give him the benefit of the doubt and decided to interrogate every suspect. Unsurprisingly, every suspect claimed their own innocence. However, some suspects also provided an alibi for other suspects. Specifically, a suspect \(A\) provided an alibi for suspect \(B\) if and only if \(A\) was in the room for the entire duration \(B\) was in the room.

You feel like a suspect is more convincing if they have an alibi provided by a suspect who is convincing themselves. Formally, a suspect without an alibi has convincingness \(0\). Otherwise, their convincingness is \(1\) more than the convincingness of the most convincing suspect who provides them with an alibi. Your task is to compute the convincingness of each suspect.

제약
입력 형식

The input consists of:
- One line with a single integer \(n\) (\(1\leq n\leq 2\cdot 10^5\)), the number of suspects.
- \(n\) lines, each with two integers \(a\) and \(t\) (\(1\leq a,t\leq 10^9\)), the time at which each suspect arrived and the duration they stayed.

It is guaranteed that no two suspects who arrived at the same moment stayed for the same duration.

출력 형식

Output the convincingness of each suspect.

예제 1
입력
4
2 8
1 7
4 5
5 2
출력
0 0 1 2
예제 2
입력
5
2 4
3 3
2 2
4 2
4 1
출력
0 1 1 2 3
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC NWERC 2022

평가 및 의견

J. Justice Served

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 1 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

J. Justice Served

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8