Submission #3388835


Source Code Expand

mod = 10**9+7
N = int(input())
L = []
for _ in range(N):
    L.append([int(input()), 0])
for _ in range(N):
    L.append([int(input()), 1])
L.sort()
a = 0
b = 0
ans = 1
for val, ab in L:
    if ab==0:
        if b>0:
            ans = ans * b % mod
            b-=1
        else:
            a+=1
    else:
        if a>0:
            ans = ans * a % mod
            a-=1
        else:
            b+=1
print(ans)

Submission Info

Submission Time
Task A - 1D Matching
User nagiss
Language Python (3.4.3)
Score 500
Code Size 439 Byte
Status AC
Exec Time 785 ms
Memory 30740 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 2
AC × 14
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 AC 430 ms 19856 KB
001.txt AC 153 ms 9120 KB
002.txt AC 207 ms 11516 KB
003.txt AC 239 ms 12504 KB
004.txt AC 656 ms 27784 KB
005.txt AC 785 ms 30672 KB
006.txt AC 769 ms 30628 KB
007.txt AC 783 ms 30672 KB
008.txt AC 738 ms 30736 KB
009.txt AC 723 ms 30728 KB
010.txt AC 691 ms 30676 KB
011.txt AC 723 ms 30740 KB
example0.txt AC 17 ms 3064 KB
example1.txt AC 17 ms 3064 KB