parent
74d3bef510
commit
e9093934cf
@ -1,6 +1,6 @@
|
|||||||
p ARGF.read.lines(chomp: true)
|
p ARGF.read
|
||||||
.map { _1.split(?,) }
|
.scan(/(\d+)-(\d+),(\d+)-(\d+)/)
|
||||||
.map {|x| x.map { _1.split(?-).map(&:to_i) }}
|
.map { _1.map(&:to_i) }
|
||||||
.map {|(a,b),(x,y)| [(a..b), (x..y)] }
|
.map {|a,b,c,d| [(a..b), (c..d)] }
|
||||||
# .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) || b.cover?(a) } # part 1
|
||||||
.count {|a,b| (a.cover?(b.begin) || a.cover?(b.end)) || (b.cover?(a.begin) || b.cover?(a.end)) }
|
.count {|a,b| a.minmax.any? { b.cover?(_1) } || b.minmax.any? { a.cover?(_1) }}
|
||||||
|
Loading…
Reference in new issue