Submission #4620836


Source Code Expand

import bisect

N = int(input())
a = []
b = []
bb = []

for i in range(N):
	a.append(int(input()))

for i in range(N):
	b.append(int(input()))

a = sorted(a)
b = sorted(b)

for i in range(N):
	bb.append(bisect.bisect_left(a, b[i]))

ans = 1
for i in range(N):
	if bb[i] - i != 0:
		if bb[i] > i:
			ans = ans * (bb[i] - i)
		else:
			ans = ans * (i - bb[i] + 1)
		ans = ans % 1000000007

print(ans)

Submission Info

Submission Time
Task A - 1D Matching
User su_565fx
Language Python (3.4.3)
Score 500
Code Size 425 Byte
Status AC
Exec Time 547 ms
Memory 14888 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 329 ms 10108 KB
001.txt AC 128 ms 5624 KB
002.txt AC 166 ms 6580 KB
003.txt AC 187 ms 7052 KB
004.txt AC 473 ms 13576 KB
005.txt AC 532 ms 14888 KB
006.txt AC 547 ms 14880 KB
007.txt AC 534 ms 14884 KB
008.txt AC 528 ms 14880 KB
009.txt AC 527 ms 14880 KB
010.txt AC 520 ms 12260 KB
011.txt AC 509 ms 14880 KB
example0.txt AC 17 ms 3064 KB
example1.txt AC 17 ms 3064 KB