#518
Silver IV
Just Stalling
시간 제한
2s
메모리 제한
1024MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Farmer John has NN cows (1N201\le N \leq 20) of heights a1aNa_1 \ldots a_N. His barn has NN stalls with max height limits b1bNb_1 \ldots b_N (so for example, if b5=17b_5 = 17, then a cow of height at most 1717 can reside in stall 55). In how many distinct ways can Farmer John arrange his cows so that each cow is in a different stall, and so that the height limit is satisfied for every stall?

입력

The first line contains NN. The second line contains NN space-separated integers a1,a2,,aNa_1,a_2,\ldots,a_N. The third line contains NN space-separated integers b1,b2,,bNb_1,b_2,\ldots,b_N. All heights and limits are in the range [1,109][1,10^9].

출력

The number of ways Farmer John can place each cow into a different stall such that the height limit is satisfied for every stall. Note that the large size of the output might require the use of a 64-bit integer, like a "long long" in C++.

예제 입력 1

4
1 2 3 4
2 4 3 4

예제 출력 1

8

점수

Test cases 1-5 satisfy N8N\le 8.Test cases 6-12 satisfy no additional constraints.

코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Silver IV1명 투표· 약 1개월 전
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.