Submission #2013689


Source Code Expand

N = int(input())
src = []
for i in range(2*N):
    src.append((int(input()), i//N))

ans = 1
MOD = 10**9+7
mem = [0, 0]
for a,t in sorted(src):
    if mem[1-t] > 0:
        ans = (ans * mem[1-t]) % MOD
        mem[1-t] -= 1
    else:
        mem[t] += 1
print(ans)

Submission Info

Submission Time
Task A - 1D Matching
User prd_xxx
Language Python (3.4.3)
Score 500
Code Size 278 Byte
Status AC
Exec Time 698 ms
Memory 26076 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 396 ms 17012 KB
001.txt AC 146 ms 8108 KB
002.txt AC 200 ms 10116 KB
003.txt AC 232 ms 10980 KB
004.txt AC 605 ms 23644 KB
005.txt AC 693 ms 26020 KB
006.txt AC 668 ms 26072 KB
007.txt AC 676 ms 26008 KB
008.txt AC 695 ms 26076 KB
009.txt AC 698 ms 26040 KB
010.txt AC 635 ms 26016 KB
011.txt AC 698 ms 26076 KB
example0.txt AC 17 ms 3064 KB
example1.txt AC 17 ms 3064 KB