module AtCoderFriends::Parser::Interactive

detect interactive problem

Constants

FLUSH_PAT
INTERACTIVE_PAT

Public Instance Methods

process(pbm) click to toggle source
# File lib/at_coder_friends/parser/interactive.rb, line 17
def process(pbm)
  pbm.options.interactive = false

  body = pbm.body_content
  f_int = body =~ INTERACTIVE_PAT
  f_flush = body =~ FLUSH_PAT
  f_io = pbm.sections[Problem::SECTION_IO_FMT]
  f_tbl =
    pbm
    .sections[Problem::SECTION_IO_SMP]
    &.find_element(%w[table])
  return unless [f_int, f_flush, f_io, f_tbl].count(&:itself) > 1

  pbm.options.interactive = true
end