Submission #3282775


Source Code Expand

M = 1000000007
N = gets.to_i
xs = []
(0...N).each{
  x = gets.to_i
  xs << [x, 0]
}
(0...N).each{
  x = gets.to_i
  xs << [x, 1]
}
xs.sort!

ans = 1
box = 0
bt = nil
xs.each{ |x,t|
  #p [ans, box, bt, [x,t]]
  if !bt
    box = 1
    bt = t
    next
  end
  
  if t == bt
    box += 1
  else
    ans = (ans * box) % M
    box -= 1
    if box == 0
      bt = nil
    end
  end
}
p ans

Submission Info

Submission Time
Task A - 1D Matching
User Corvvs
Language Ruby (2.3.3)
Score 500
Code Size 416 Byte
Status AC
Exec Time 1147 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 662 ms 11204 KB
001.txt AC 219 ms 5408 KB
002.txt AC 309 ms 6648 KB
003.txt AC 352 ms 7032 KB
004.txt AC 1009 ms 17540 KB
005.txt AC 1139 ms 18424 KB
006.txt AC 1121 ms 18424 KB
007.txt AC 1136 ms 19320 KB
008.txt AC 1137 ms 18424 KB
009.txt AC 1142 ms 18424 KB
010.txt AC 1097 ms 18424 KB
011.txt AC 1147 ms 18424 KB
example0.txt AC 7 ms 1788 KB
example1.txt AC 7 ms 1788 KB