RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
문제 COCI00702

Rima

설명

In Croatian class, Jakov reads a poem consisting of \(n\) lines and \(n/4\) stanzas. Lines
1, 2, 3, and 4 make up the first stanza, lines 5, 6, 7, and 8 the second stanza, and
so on. Each line in each stanza consists of exactly \(m\) words.
We say that two lines rhyme if the last \(k\) letters of their last words match. If the
last word in one of the lines consists of fewer than \(k\) letters, then the lines do not
rhyme.
At the stanza level, we distinguish three types of rhyme schemes:
• AABB – lines 1 and 2 rhyme, and lines 3 and 4 rhyme
• ABAB – lines 1 and 3 rhyme, and lines 2 and 4 rhyme
• ABBA – lines 1 and 4 rhyme, and lines 2 and 3 rhyme
The teacher asked Jakov to determine in how many stanzas of the poem each of
these three types of rhyme schemes appears. Help Jakov answer the teacher correctly and get an A in
Croatian class!

제약
입력 형식

The first line contains the natural numbers \(n\), \(m\) and \(k\) (\(1 \le n \le 500\) and \(n\) is divisible by 4, \(1 \le m\), \(k \le 20\))
from the text of the task.
The next \(n\) lines contain \(m\) words each, with each word being made up of at most 20 lowercase letters of
the English alphabet.

출력 형식

In the first and only line, write three numbers: the number of stanzas in which AABB rhyme appears, the
number of stanzas in which ABAB rhyme appears, and the number of stanzas in which ABBA rhyme
appears.

서브태스크
서브태스크점수설명

1

15점

\(n = 4\)

2

15점

Each word is made up of 1 character.

3

20점

No additional constraints.

예제 1
입력
8 2 3
aa bb
cc bb
dd ee
ff ee
auu aaaaaahh
auu wer
asdf power
lol kldahh
출력
0 0 1
예제 2
입력
8 2 2
ja programiram
mjesec listopad
ponekad chillam
voda vodopad
banana jabuka
fiziku znam
teska odluka
njam njam
출력
0 2 0
예제 3
입력
4 4 2
pas konj zec macka
trokut teziste poluravnina tocka
nogomet tenis ragbi odbojka
sir mlijeko kulen sunka
출력
1 1 1
설명

Clarification of the first example: In the first stanza, not a single pair of lines can rhyme, because
each last word has only 2 letters, and k = 3. The second stanza follows an ABBA rhyme scheme because
the 1st and 4th lines rhyme (aaaaaahh and kldahh), and the 2nd and 3rd lines also rhyme (wer and
power). Thus, AABB and ABAB rhymes occur 0 times, while ABBA rhyme occurs once.
Clarification of the third example: In the only stanza of this poem, the last two letters of the last
word in each line are ka, so all lines rhyme with each other. It follows that all three types of rhyme
schemes appear in this stanza: AABB, ABAB and ABBA.

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2025/2026 Contest 1

평가 및 의견

Rima

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Rima

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8