Submission #4415366
Source Code Expand
import sys MOD = 10**9 + 7 N = int(input()) As = [int(sys.stdin.readline()) for _ in range(N)] + [10**9 + 1] Bs = [int(sys.stdin.readline()) for _ in range(N)] + [10**9 + 1] As.sort() Bs.sort() ans = 1 iA = iB = 0 for _ in range(2*N): if iA > iB and As[iA] > Bs[iB]: ans *= iA - iB ans %= MOD elif iA < iB and As[iA] < Bs[iB]: ans *= iB - iA ans %= MOD if As[iA] < Bs[iB]: iA += 1 else: iB += 1 print(ans)
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | ZollingerPython3 |
Language | Python (3.4.3) |
Score | 500 |
Code Size | 503 Byte |
Status | AC |
Exec Time | 316 ms |
Memory | 11792 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 500 / 500 | ||||
Status |
|
|
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 | 182 ms | 8260 KB |
001.txt | AC | 74 ms | 4920 KB |
002.txt | AC | 95 ms | 5672 KB |
003.txt | AC | 106 ms | 6028 KB |
004.txt | AC | 253 ms | 10712 KB |
005.txt | AC | 286 ms | 11664 KB |
006.txt | AC | 286 ms | 11660 KB |
007.txt | AC | 316 ms | 11656 KB |
008.txt | AC | 299 ms | 11664 KB |
009.txt | AC | 298 ms | 11664 KB |
010.txt | AC | 283 ms | 11792 KB |
011.txt | AC | 289 ms | 11660 KB |
example0.txt | AC | 17 ms | 3064 KB |
example1.txt | AC | 17 ms | 3064 KB |