You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
7 lines
344 B
7 lines
344 B
p ARGF.read.lines(chomp: true)
|
|
.map { _1.split(?,) }
|
|
.map {|x| x.map { _1.split(?-).map(&:to_i) }}
|
|
.map {|(a,b),(x,y)| [(a..b), (x..y)] }
|
|
# .count {|a,b| (a.cover?(b.begin) && a.cover?(b.end)) || (b.cover?(a.begin) && b.cover?(a.end)) }
|
|
.count {|a,b| (a.cover?(b.begin) || a.cover?(b.end)) || (b.cover?(a.begin) || b.cover?(a.end)) }
|