Submission #1000745
Source Code Expand
from heapq import heapify, heappush, heappop n = input() ps = [(int(raw_input()), i<n) for i in xrange(2*n)] ps.sort() MOD = 10**9+7 cnt = 0 ans = 1 for p, v in ps: if v == 0: if cnt > 0: ans *= cnt ans %= MOD cnt -= 1 else: if cnt < 0: ans *= -cnt ans %= MOD cnt += 1 print ans
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | yaketake08 |
Language | Python (2.7.6) |
Score | 500 |
Code Size | 388 Byte |
Status | AC |
Exec Time | 668 ms |
Memory | 24240 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 | 377 ms | 15756 KB |
001.txt | AC | 144 ms | 7424 KB |
002.txt | AC | 196 ms | 9344 KB |
003.txt | AC | 219 ms | 10100 KB |
004.txt | AC | 577 ms | 21996 KB |
005.txt | AC | 668 ms | 24168 KB |
006.txt | AC | 660 ms | 24240 KB |
007.txt | AC | 657 ms | 24168 KB |
008.txt | AC | 660 ms | 24236 KB |
009.txt | AC | 644 ms | 24240 KB |
010.txt | AC | 631 ms | 24172 KB |
011.txt | AC | 644 ms | 24240 KB |
example0.txt | AC | 16 ms | 2692 KB |
example1.txt | AC | 16 ms | 2692 KB |