# # フォーマットチェック用🍣 # # フォーマットが正しいとWrongAnswerになる. # 不適合ならRuntimeErrorになる. # # このプログラムで見ないところ(別提出で検査済み) # ・座席のダブルブッキング line = gets.chomp! abort "line 1: format" unless line=~/^\d+$/ numberOfQuery = line.to_i abort "line 1: 2 <= numberOfQuery <= 5005" unless 2 <= numberOfQuery && numberOfQuery <= 5005 sushineta = {} numberOfQuery.times{|lineNo| line = gets.chomp! abort "line #{lineNo+2}: end of line" unless line abort "line #{lineNo+2}: format" unless line=~/^\S+.+\S+$/ list = line.split type = list.shift case type when '0' abort "line #{lineNo+2}: size of parameters(nm)" unless 2 <= list.size n = list.shift.to_i # 座る座席 m = list.shift.to_i # a number of 🍣 abort "line #{lineNo+2}: size of parameters(sushi)" unless m == list.size abort "line #{lineNo+2}: 1 <= n <= 20" unless 1 <= n && n <= 20 abort "line #{lineNo+2}: 0 <= m <= 10" unless 0 <= m && m <= 10 list.each{|sushi| abort "line #{lineNo+2}: 寿司ネタはアルファベット表記で記述され最大15文字" unless sushi.size <= 15 sushineta[sushi] = true } when '1' abort "line #{lineNo+2}: size of parameters" unless 1 == list.size sushi = list.shift sushineta[sushi] = true abort "line #{lineNo+2}: 寿司ネタはアルファベット表記で記述され最大15文字" unless sushi.size <= 15 when '2' abort "line #{lineNo+2}: size of parameters" unless 1 == list.size n = list.shift.to_i abort "line #{lineNo+2}: 1 <= n <= 20" unless 1 <= n && n <= 20 else abort "line #{lineNo+2}: unknown data type" end } abort "line **: too many lines" unless !gets abort "line **: too many kind of sushi " unless sushineta.size <= 53