Logo
(追記) (追記ここまで)

17932번 - Haiku 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB86302028.986%

문제

A haiku is a Japanese form of poetry. It consists of three phrases of 5ドル,ドル 7ドル$ and 5ドル$ syllables each.

Once a year, HiQ has a haiku contest, where employees submit their best poems. The poems are then judged based on a wide range of aspects, such as

  • creativity
  • simplicity
  • beauty
  • whether the poem is actually a haiku

This last point turned out to be quite a challenge for the judges (many problems arose when half the judges indexed syllables starting at 0ドル$ and the other half at 1ドル$).

Can you help the judges to determine whether a submitted poem is a haiku, given a set of syllables? Note that there may exist multiple decompositions of a single word in the poem into syllables. In this case, you should determine whether some decomposition is a haiku.

입력

The first line of input contains a single integer 1ドル \le S \le 100,ドル the number of syllables. The next line contains $S$ words separated by spaces (the syllables). Each syllable contains at most 7ドル$ lowercase letters a-z.

Then, three lines containing the poem follow. Each line contains a (non-empty) list of words separated by spaces, representing a phrase. The words contain only lowercase letters a-z. The length of each line is at most 100ドル$ characters (including spaces).

It is guaranteed that there exists at least one decomposition of the poem into the given syllables.

출력

Output "haiku" if the given poem is a haiku, and "come back next year" otherwise (without the quotes).

제한

예제 입력 1

20
va
fi
ve
mor
lling
spe
in
i
sh
ti
hard
cov
ear
fe
red
ja
ry
need
ly
ning
spelling very hard
early in morning tired
i need covfefe

예제 출력 1

haiku

One possible decomposition into a haiku is:

spe-lling ve-ry hard
ear-ly in mor-ning ti-red
i need cov-fe-fe

예제 입력 2

22
q
c
da
plus
to
the
e
thee
un
late
ci
a
shall
by
com
i
ru
pare
temp
ble
hi
de
shall i compare thee
to a c plus plus template
undecidable

예제 출력 2

haiku

예제 입력 3

19
ju
win
soft
it
east
sun
and
light
der
the
is
through
li
but
yon
what
breaks
et
dow
but soft what light through
yonder window breaks it is
the east and juliet is the sun

예제 출력 3

come back next year

No matter how the third line is decomposed, it contains 8ドル$ syllables instead of 5ドル,ドル so it can not be a haiku.

힌트

출처

Contest > Swedish Coding Cup > HiQ Challenge 2017 C번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /