Submission #3234867


Source Code Expand

N = int(input())
a = [(int(input()), 1) for _ in range(N)]
b = [(int(input()), 0) for _ in range(N)]
X = sorted(a + b)

mod = 10 ** 9 + 7
ls = 0
stack = []
ans = 1
for v, f in X:
    if stack and stack[-1] != f:
        ans = ans * ls % mod
        stack.pop()
        ls -= 1
    else:
        stack.append(f)
        ls += 1

print(ans)

Submission Info

Submission Time
Task A - 1D Matching
User poina
Language Python (3.4.3)
Score 500
Code Size 356 Byte
Status AC
Exec Time 632 ms
Memory 27648 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 367 ms 17964 KB
001.txt AC 139 ms 8444 KB
002.txt AC 193 ms 10640 KB
003.txt AC 220 ms 11520 KB
004.txt AC 563 ms 24984 KB
005.txt AC 626 ms 27648 KB
006.txt AC 621 ms 27576 KB
007.txt AC 632 ms 27628 KB
008.txt AC 608 ms 27596 KB
009.txt AC 618 ms 27592 KB
010.txt AC 604 ms 27636 KB
011.txt AC 624 ms 27576 KB
example0.txt AC 17 ms 3064 KB
example1.txt AC 16 ms 3060 KB