아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Hoax Spreading

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

요약
각 사용자의 접속 시간 구간이 주어질 때 같은 날 동시에 접속한 사용자끼리 거짓 정보를 공유한다. 시작 사용자별로 N일 뒤 감염된 사용자 수를 구한다.
난이도

보통10점 중 6점

유형
구간, 그래프, BFS, 유니온 파인드
정답자
아직 제출이 없습니다

문제

Pak Dengklek has just developed a social media site. There are NN users using the site, numbered 00 to N−1N - 1. There are SS hours in one day. All of these users have a fixed usage schedule from day to day. For each ii such that 0≤i≤N−10 ≤ i ≤ N - 1, user ii will be online T\[i]T\[i] times every day:

  • from the start of the A\[i]\[0]A\[i]\[0]th hour to the end of the B\[i]\[0]B\[i]\[0]th hour,
  • from the start of the A\[i]\[1]A\[i]\[1]th hour to the end of the B\[i]\[1]B\[i]\[1]th hour
  • ...
  • and from the start of the A\[i]\[T\[i]−1]A\[i]\[T\[i] - 1]th hour to the end of the B\[i]\[T\[i]−1]B\[i]\[T\[i] - 1]th hour.

At any time, all users on the site like to share news to all other online users. Unfortunately, one of the NN users has a hoax at the start of the first day and will spread it. Hence, all users who meet the user with the hoax will also have the hoax at the end of the first day. Two users are stated to be met if there is at least an hour where the two users are both online.

This hoax will also be spread on the second day. Therefore, all users who meet the user with the hoax at the end of the first day will also have the hoax at the end of the second day. This continued the following days.

There are QQ scenarios, each can be represented as an integer PP. For each scenario, the user who has the hoax at the start of the first day is user PP. A different scenario might cause a different hoax spreading. Therefore, for each scenario, Pak Dengklek wonders on the number of users with the hoax at the end of the NNth day, where NN is the number of users.

제한

  • 1≤N≤200,0001 ≤ N ≤ 200\\,000
  • 1≤S≤109 1 ≤ S ≤ 10^9
  • 1≤Q≤100,000 1 ≤ Q ≤ 100\\,000
  • 1≤T\[i]≤S 1 ≤ T\[i] ≤ S (for each ii such that 0≤i≤N−10 ≤ i ≤ N - 1)
  • The sum of all elements of TT does not exceed 200,000200\\,000.
  • 1≤A\[i]\[j]≤B\[i]\[j]≤S1 ≤ A\[i]\[j] ≤ B\[i]\[j] ≤ S (for each ii and jj such that 0≤i≤N−10 ≤ i ≤ N - 1 and 0≤j≤T\[i]−10 ≤ j ≤ T\[i] - 1)
  • B\[i]\[j−1]<A\[i]\[j]B\[i]\[j - 1] < A\[i]\[j] (for each ii and jj such that 0≤i≤N−10 ≤ i ≤ N - 1 and 1≤j≤T\[i]−11 ≤ j ≤ T\[i] - 1)
  • 0≤P≤N−10 ≤ P ≤ N - 1
  • The values of PP among all scenarios are pairwise distinct.

예제

이 문제는 공개된 예제가 없습니다.