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

17637번 - Count Squares 서브태스크다국어

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

문제

Alice took a clean sheet of paper and drew h horizontal and v vertical lines onto the paper.

The horizontal lines have y-coordinates y1, . . . , yh, and the vertical lines have x-coordinates x1, . . . , xv.

Given these coordinates, count the number of squares that appeared on the paper.

(The whole boundary of the square has to be drawn. The inside of the square does not have to be empty.)

입력

The first line of input contains the integers h and v (0 ≤ h, v ≤ 1500).

The second line of input contains a strictly increasing sequence consisting of h space-separated integers: y1, . . . , yh.

The third line of input contains a strictly increasing sequence consisting of v space-separated integers: x1, . . . , xv.

All horizontal and vertical coordinates are between 0 and 230, inclusive.

출력

Output a single line with a single integer: the total number of squares.

제한

서브태스크

번호배점제한
17

h, v ≤ 2

240

h, v ≤ 600

353

No additional constraints

예제 입력 1

3 4
0 1 3
1 2 4 8

예제 출력 1

3

힌트

In the example there is one 1 × 1 square, one 2 × 2 square, and one 3 × 3 square.

출처

Olympiad > Central European Olympiad in Informatics > CEOI 2019 > Practice 1번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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