Submission #1966899


Source Code Expand

n,*a=$<.map &:to_i
mod=10**9+7
res=1
c=d=0
a.map.with_index{|x,i|[x,i<n]}.sort.each do |x,pc|
    if pc
        d>0 ? (res=res*d%mod; d-=1) : c+=1
    else
        c>0 ? (res=res*c%mod; c-=1) : d+=1
    end
end
p res

Submission Info

Submission Time
Task A - 1D Matching
User hogeover30
Language Ruby (2.3.3)
Score 500
Code Size 229 Byte
Status AC
Exec Time 1103 ms
Memory 18680 KB

Compile Error

./Main.rb:1: warning: `&' interpreted as argument prefix

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 630 ms 11716 KB
001.txt AC 214 ms 5280 KB
002.txt AC 306 ms 6808 KB
003.txt AC 344 ms 7392 KB
004.txt AC 961 ms 16900 KB
005.txt AC 1084 ms 18680 KB
006.txt AC 1088 ms 18680 KB
007.txt AC 1097 ms 18680 KB
008.txt AC 1085 ms 18680 KB
009.txt AC 1082 ms 18680 KB
010.txt AC 1053 ms 18680 KB
011.txt AC 1103 ms 18680 KB
example0.txt AC 7 ms 1788 KB
example1.txt AC 7 ms 1788 KB