RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00196

Ples

Gold IV 골드 IV
난이도
1s
시간 제한
32MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

There are \(N\) boys and \(N\) girls at a dance party. We have measured their heights. Each boy will only dance with a girl and each girl will only dance with a boy. Everyone will dance with at most one partner.

Each boy either wants to dance with a girl who is taller than him or with a girl who is shorter than him. Analogously, each girl either wants to dance with a boy who is taller than her or with a boy who is shorter than her. Boys and girls who are equally tall never want to dance with each other.

Respecting everyone's wishes, determine the maximum number of dancing pairs that can be achieved.

제약
입력 형식

The first line of input contains the positive integer \(N\) (\(1 \le N \le 100\,000\)).

The second line of input contains \(N\) integers whose absolute values are between \(1500\) and \(2500\), inclusive. Their absolute values represent the height of each of the boys in millimetres. Positive height values indicate boys who want to dance with girls taller than themselves, while negative height values indicate boys who want to dance with girls shorter than themselves.

The third line of input contains \(N\) integers whose absolute values are between \(1500\) and \(2500\), inclusive. Their absolute values represent the height of each of the girls in millimetres. Positive height values indicate girls who want to dance with boys taller than themselves, while negative height values indicate girls who want to dance with boys shorter than themselves.

출력 형식

The only line of output must contain the maximum number of dancing pairs.

서브태스크
서브태스크점수설명

Test 1

3점

None

Test 2

3점

None

Test 3

3점

None

Test 4

3점

None

Test 5

3점

None

Test 6

3점

None

Test 7

3점

None

Test 8

3점

None

Test 9

3점

None

Test 10

3점

None

Test 11

3점

None

Test 12

3점

None

Test 13

3점

None

Test 14

3점

None

Test 15

3점

None

Test 16

3점

None

Test 17

3점

None

Test 18

3점

None

Test 19

3점

None

Test 20

3점

None

Test 21

3점

None

Test 22

3점

None

Test 23

3점

None

Test 24

3점

None

Test 25

2점

None

Test 26

2점

None

Test 27

2점

None

Test 28

2점

None

Test 29

2점

None

Test 30

2점

None

Test 31

2점

None

Test 32

2점

None

Test 33

2점

None

Test 34

2점

None

Test 35

2점

None

Test 36

2점

None

Test 37

2점

None

Test 38

2점

None

예제 1
입력
1
-1800
1800
출력
0
예제 2
입력
1
1700
-1800
출력
1
예제 3
입력
2
-1800 -2200
1900 1700
출력
2
문제 정보

riseoj 작성

출처 COCI 2011/2012 Contest 1

평가 및 의견

Ples

개요
출제자 난이도 Gold IV 골드 IV 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

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

풀이 제출

Ples

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