Submission #3276604


Source Code Expand

from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

N = int(input())
points = []
for i in range(N):
    a = int(input())
    points.append([a,True])
for i in range(N):
    b = int(input())
    points.append([b,False])
points.sort()

ans = 1
an = bn = 0
for x,c in points:
    if c:
        if bn > 0:
            ans *= bn
            bn -= 1
        else:
            an += 1
    else:
        if an > 0:
            ans *= an
            an -= 1
        else:
            bn += 1    

print(ans)

Submission Info

Submission Time
Task A - 1D Matching
User simamumu
Language Python (3.4.3)
Score 0
Code Size 754 Byte
Status WA
Exec Time 2105 ms
Memory 31892 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 2
AC × 3
WA × 4
TLE × 7
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 WA 1310 ms 21252 KB
001.txt WA 257 ms 10256 KB
002.txt WA 387 ms 12652 KB
003.txt WA 458 ms 13652 KB
004.txt TLE 2105 ms 30272 KB
005.txt TLE 2105 ms 31820 KB
006.txt TLE 2105 ms 31892 KB
007.txt TLE 2105 ms 31812 KB
008.txt TLE 2105 ms 31884 KB
009.txt TLE 2105 ms 31888 KB
010.txt TLE 2105 ms 31816 KB
011.txt AC 780 ms 31892 KB
example0.txt AC 29 ms 4208 KB
example1.txt AC 29 ms 4208 KB