Submission #2013621


Source Code Expand

N = int(input())
a = [int(input()) for i in range(N)]
a.sort()
b = [int(input()) for i in range(N)]
b.sort()
MOD = 10**9+7

f = [1]
def factorial(n):
    while len(f) <= n:
        f.append((f[-1] * len(f)) % MOD)
    return f[n]

ans = 1
ai = bi = sec = 0
while ai + bi < 2*N:
    if ai == N:
        bi += 1
    elif bi == N:
        ai += 1
    elif a[ai] < b[bi]:
        ai += 1
    else:
        bi += 1
    if ai == bi:
        n = ai - sec
        ans = (ans * factorial(n)) % MOD
        sec = ai
print(ans)

Submission Info

Submission Time
Task A - 1D Matching
User prd_xxx
Language Python (3.4.3)
Score 0
Code Size 544 Byte
Status WA
Exec Time 544 ms
Memory 15376 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 310 ms 9396 KB
001.txt WA 124 ms 5620 KB
002.txt WA 162 ms 5784 KB
003.txt WA 182 ms 6300 KB
004.txt WA 466 ms 12816 KB
005.txt WA 500 ms 11860 KB
006.txt WA 498 ms 12344 KB
007.txt WA 484 ms 11988 KB
008.txt WA 498 ms 13388 KB
009.txt WA 498 ms 11984 KB
010.txt AC 514 ms 15376 KB
011.txt AC 544 ms 11344 KB
example0.txt AC 17 ms 3064 KB
example1.txt AC 17 ms 3064 KB