포럼
문제 COCI00454

Tetris

설명

Ivica is a passionate computer scientist. He recently started working on his first computer
game: a clone of the popular Tetris. Although he’s far from being finished, his program
supports placing five different Tetris figures shown in the image below in a matrix. Before
placing it in the Tetris matrix, the figure can be rotated by 90 degrees an arbitrary number of
times and coloured. Additionally, the current version of the game doesn’t support placing the
figure if that would mean it goes out of the matrix boundaries or overlaps with another
existing figure in the matrix.
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
While Ivica was in school, his sister Marica started the game and randomly rotated, coloured
and placed the figures in a way that the adjacent figures are coloured differently. Two figures
are adjacent if they share a common side or touch in the tip.
When Ivica came back to his computer, he found the game running with the figures his sister
placed. He wants to know how many of which figures there are in the Tetris matrix and he is
asking you to help him solve this problem while he’s busy with improving the game.

제약

In test cases worth 20% of total points, only the first figure will appear.
In test cases worth an additional 20% of total points, only the first two figures will appear.
In test cases worth an additional 20% of total points, only the first three figures will appear.
In test cases worth an additional 20% of total points, only the first four figures will appear.

입력 형식

The first line of input contains positive integers \(N\) and \(M\) (\(1 \le N\), \(M \le 10\)) that represent the
number of rows and columns of the Tetris matrix.
Each of the following \(N\) lines contains \(M\) characters that represent the matrix. Each character
can be ‘.’ (dot) that represents a blank space or a lowercase letter of the English alphabet
that represents a part of the figure. Different letters represent different colours, and the parts
of the same figure are coloured the same.

출력 형식

You must output exactly five rows. The i^{th} line must contain the number of appearances of
the i^{th} figure in the game of Tetris.

예제 1
입력
4 5
aaaa.
.bb..
.bbxx
...xx
출력
2
1
0
0
0
예제 2
입력
4 5
.aab.
aabb.
.cbaa
cccaa
출력
1
0
1
1
1
예제 3
입력
5 7
.c.....
ccdddd.
caabbcc
aabbacc
...aaa.
출력
1
1
2
1
1
문제 정보

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

출처 COCI 2017/2018 Contest 1

평가 및 의견

Tetris

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

Log in to rate problems.

개별 의견

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

풀이 제출

Tetris

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