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

24999번 - Prom 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB64453468.000%

문제

Johnny is getting ready for prom, which traditionally begins with a polonnaise dance. Any mixed pair (boy and girl) can lead the polonnaise, as long as they do not differ too much in height. More precisely, the difference in their heights cannot exceed $k$ byteometers. Jimmy wants to find out how many ways there are to choose the leading pair.

Write a program which reads the heights of all girls and boys, computes the number of possible leading pairs, and writes the result to standard output.

입력

The first line of input contains three space-separated integers $n,ドル $m$ and $k$ (1ドル \le n, m \le 250,000円,ドル 0ドル \le k \le 1 ,000円,000円,000円$), denoting the number of girls, the number of boys and the maximum possible difference of height in the leading pair, respectively.

The second line of input contains a sequence of $n$ space-separated integers $a_i$ (1ドル \le a_i \le 1,000円,000円,000円$): the heights of girls, given in byteometers.

The third line of input contains a sequence of $m$ space-separated integers $b_i$ (1ドル \le b_i \le 1,000円,000円,000円$): the heights of boys, given in byteometers.

출력

The first and only line of output should contain a single integer --- the number of possible leading pairs.

제한

예제 입력 1

4 5 5
15 2 5 7
1 5 10 15 1

예제 출력 1

11

노트

There are 11ドル$ possible leading pairs: $(15,10),ドル $(15,15),ドル $(1,1),ドル $(1,5),ドル $(1,1),ドル $(5,1),ドル $(5,5),ドル $(5,10),ドル $(5,1),ドル $(7,5)$ and $(7,10)$.

출처

ICPC > Regionals > Europe > Central European Regional Contest > Poland Collegiate Programming Contest > AMPPZ 2015 D번

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

출처

대학교 대회

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

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