Submission #3339658


Source Code Expand

n = int(input())
a = [('a',int(input())) for _ in range(n)]
b = [('b',int(input()))for _ in range(n)]
ab = sorted(a+b, key=lambda x: x[1])
m = []
count = 0
for k,i in ab:
    if k == 'a':
        if count < 0:
            m.append(-count)
        count += 1
    else:
        if count > 0:
            m.append(count)
        count -= 1
ans = 1
for mm in m:
    ans *= mm
    ans %= 10**9+7
print(ans)

Submission Info

Submission Time
Task A - 1D Matching
User krswrb
Language Python (3.4.3)
Score 500
Code Size 422 Byte
Status AC
Exec Time 572 ms
Memory 30272 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 331 ms 19308 KB
001.txt AC 128 ms 9048 KB
002.txt AC 169 ms 11336 KB
003.txt AC 194 ms 12268 KB
004.txt AC 489 ms 27304 KB
005.txt AC 572 ms 29876 KB
006.txt AC 556 ms 30000 KB
007.txt AC 553 ms 29992 KB
008.txt AC 556 ms 29948 KB
009.txt AC 561 ms 29940 KB
010.txt AC 545 ms 30272 KB
011.txt AC 555 ms 29940 KB
example0.txt AC 17 ms 3064 KB
example1.txt AC 17 ms 3064 KB