Submission #3597821


Source Code Expand

N = int(input())
mod = 10**9 + 7

a = [(int(input()), 0) for _ in range(N)]
b = [(int(input()), 1) for _ in range(N)]
ab = sorted(a+b, key = lambda x: x[0])
ans = 1
stack = []
for i, j in ab:
    if stack and stack[-1] != j:
        ans = ans * len(stack) %mod
        stack.pop()
    else:
        stack.append(j)
print(ans)

Submission Info

Submission Time
Task A - 1D Matching
User Tallfall
Language Python (3.4.3)
Score 500
Code Size 339 Byte
Status AC
Exec Time 592 ms
Memory 30264 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 334 ms 19276 KB
001.txt AC 127 ms 8924 KB
002.txt AC 174 ms 11324 KB
003.txt AC 188 ms 12280 KB
004.txt AC 490 ms 27244 KB
005.txt AC 584 ms 29992 KB
006.txt AC 560 ms 30012 KB
007.txt AC 592 ms 29996 KB
008.txt AC 572 ms 29928 KB
009.txt AC 549 ms 29920 KB
010.txt AC 553 ms 30264 KB
011.txt AC 547 ms 29940 KB
example0.txt AC 17 ms 3064 KB
example1.txt AC 17 ms 3064 KB