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

18480번 - Four Elements 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB108282127.273%

문제

You have a set A of non-negative integers that is a union of n ranges [li; ri]. How many 4-element subsets with sum equal to s does A contain? Output this number modulo 998 244 353.

입력

The first line of the input contains two integers n and s (1 ≤ n ≤ 400; 0 ≤ s ≤ 8 · 108), denoting the number of ranges and the required sum.

Each of the following n lines contains two integers li and ri (0 ≤ li ≤ ri ≤ 2·108; ri < li+1), denoting the boundaries of the i-th range.

출력

Display the number of 4-element subsets of A with sum equal to s, modulo 998 244 353.

제한

예제 입력 1

2 17
1 3
5 8

예제 출력 1

4

힌트

In the example test case, A = {1, 2, 3, 5, 6, 7, 8}. Its 4-element subsets with sum equal to 17 are {1, 2, 6, 8}, {1, 3, 5, 8}, {1, 3, 6, 7}, and {2, 3, 5, 7}.

출처

Camp > Petrozavodsk Programming Camp > Winter 2019 > Day 5: Gennady Korotkevich Contest 4 D번

Contest > Open Cup > 2018/2019 Season > Stage 11: Grand Prix of Gomel D번

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

출처

대학교 대회

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

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