Submission #1004944


Source Code Expand

c=0
r=1
n=gets.to_i
(2*n).times.map{|i|[gets.to_i,i<n]}.sort.each{|k,v|
	if !v
		r*=c if c>0
		c-=1
	else
		r*=-c if c<0
		c+=1
	end
	r%=10**9+7
}
p r

Submission Info

Submission Time
Task A - 1D Matching
User leafmoon
Language Ruby (2.3.3)
Score 500
Code Size 163 Byte
Status AC
Exec Time 951 ms
Memory 19320 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 564 ms 12100 KB
001.txt AC 193 ms 5664 KB
002.txt AC 271 ms 6936 KB
003.txt AC 304 ms 7416 KB
004.txt AC 840 ms 18820 KB
005.txt AC 943 ms 19320 KB
006.txt AC 951 ms 19320 KB
007.txt AC 944 ms 19320 KB
008.txt AC 948 ms 19320 KB
009.txt AC 941 ms 19320 KB
010.txt AC 923 ms 19320 KB
011.txt AC 950 ms 19320 KB
example0.txt AC 11 ms 1788 KB
example1.txt AC 10 ms 1788 KB