Submission #11157699


Source Code Expand

N = int(input())

mod = int(1e9+7)

A = []
for _ in range(N):
  A.append([int(input()),1])
for _ in range(N):
  A.append([int(input()),2])
A.sort()

ans = 1
ca,cb = 0,0
for a in A:
  if a[1] == 1:
    if cb == 0:
      ca += 1
    else:
      ans = ans * cb % mod
      cb -= 1      
  else:
    if ca == 0:
      cb += 1
    else:
      ans = ans * ca % mod
      ca -= 1
    
print(ans)

Submission Info

Submission Time
Task A - 1D Matching
User mo2
Language PyPy3 (2.4.0)
Score 500
Code Size 415 Byte
Status AC
Exec Time 1485 ms
Memory 78936 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 980 ms 66392 KB
001.txt AC 510 ms 54104 KB
002.txt AC 603 ms 57176 KB
003.txt AC 657 ms 58072 KB
004.txt AC 1318 ms 75864 KB
005.txt AC 1476 ms 78680 KB
006.txt AC 1485 ms 78552 KB
007.txt AC 1470 ms 78936 KB
008.txt AC 1461 ms 78680 KB
009.txt AC 1468 ms 78680 KB
010.txt AC 1409 ms 78424 KB
011.txt AC 1470 ms 78552 KB
example0.txt AC 164 ms 38256 KB
example1.txt AC 165 ms 38256 KB