Submission #22101256


Source Code Expand

Copy
MOD = 10**9 + 7
N = int(input())
A = []
for _ in range(N):
    A.append((int(input()), "a"))

B = []
for _ in range(N):
    A.append((int(input()), "b"))

P = sorted(A+B) + [(0, "c")]

Q = []
cnt = 1
for i in range(1, 2*N+1):
    if P[i][1] != P[i-1][1]:
        Q.append(cnt)
        cnt = 1
    else:
        cnt += 1

ans = 1
import math
for i in range(len(Q)-1):
    ans *= math.factorial(min(Q[i], Q[i+1])) % MOD
    ans %= MOD

    Q[i+1] = max(0, Q[i+1] - Q[i])
print(ans)

Submission Info

Submission Time
Task A - 1D Matching
User shinitao
Language PyPy3 (7.3.0)
Score 0
Code Size 507 Byte
Status WA
Exec Time 722 ms
Memory 111800 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 2
AC × 4
WA × 10
Set Name Test Cases
Sample example0.txt, example1.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, example0.txt, example1.txt
Case Name Status Exec Time Memory
000.txt WA 473 ms 91564 KB
001.txt WA 227 ms 77248 KB
002.txt WA 279 ms 78860 KB
003.txt WA 300 ms 81284 KB
004.txt WA 631 ms 102304 KB
005.txt WA 714 ms 107096 KB
006.txt WA 701 ms 107268 KB
007.txt WA 707 ms 107276 KB
008.txt WA 709 ms 107332 KB
009.txt WA 704 ms 107272 KB
010.txt AC 720 ms 102924 KB
011.txt AC 722 ms 111800 KB
example0.txt AC 51 ms 62076 KB
example1.txt AC 47 ms 62088 KB