RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
USACO0241 파일 입출력

Bull in a China Shop

Platinum II 플래티넘 II
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Farmer John has decided his home needs more decoration. Visiting the local
china shop, he finds a delicate glass cow figurine that he decides to purchase,
knowing that it will fit perfectly on the mantel above his fireplace.

The shape of the cow figurine is described by an \(N \times M\) grid of characters
like the one below (\(3 \leq N, M \leq 500\)), where lowercase letter characters
are each part of the figurine (indicating different colors) and '.' characters
are not.

...............
...............
x..x...........
xxxx...........
xxxxaaaaaaa...
.xx.aaaaaaaaa..
....aaaaaaa.aa.
....ll...ll....
....vv...vv....
...............

Unfortunately, right before FJ can make his purchase, a bull runs through the
shop and breaks not only FJ's figurine, but many of the other glass objects on
the shelves as well! FJ's figurine breaks into 3 pieces, which quickly become
lost among \(K\) total pieces lying on the ground (\(4 \leq K \leq 100\)). Each of
the \(K\) pieces is described by a grid of characters, just like the original
figurine.

Please help FJ determine how many sets of 3 pieces (out of the \(K\) on the floor)
could be glued back together to mend his broken figurine.

The pieces on the ground might have been flipped vertically or horizontally, or
rotated by some multiple of 90 degrees. Therefore, given the original grid as
well as \(K\) grids describing pieces, you want to find sets of 3 pieces that can
be joined together to form the original picture, allowing the pieces to be
translated, flipped, or rotated multiples of 90 degrees. When then
superimposed, the 3 pieces should exactly form the original picture, with each
colored square in the original picture represented in exactly one of the pieces.

Problem credits: Brian Dean

제약

Problem credits: Brian Dean

입력 형식

The first line contains a single integer \(K\). Following that will be \(K + 1\)
piece descriptions. The first description will describe the original glass cow,
the following \(K\) descriptions will be of the broken pieces.

Each description begins with a line containing two integers \(R\) and \(C\)
(\(1 \le R, C \le 100\)). The following \(R\) lines contain \(C\) lowercase alphabet
characters describing the color of each cell. Each piece will be
horizontally/vertically connected and have at least one non-empty cell.

출력 형식

Output the number of triples \(i, j, k\) (\(i < j < k\)) such that pieces \(i\), \(j\),
and \(k\) can be arranged to form the original glass cow.

파일 입력 / 출력
이 문제는 표준 입출력을 사용하지 않습니다. 프로그램은 다음 파일을 읽고 써야 합니다:
입력을 읽을 파일 bcs.in
출력을 쓸 파일 bcs.out
예제 1
입력
5
5 5
aaaaa
..a..
bbabb
..a..
aaaaa
3 5
..abb
..a..
aaaaa
5 2
a.
a.
aa
a.
a.
1 2
bb
1 5
bbabb
2 5
aaaaa
..a..
출력
3
설명

The three solutions use pieces \((0, 1, 2)\), \((0, 2, 4)\), \((1, 3, 4)\).

Note that this problem has a time limit of 6 seconds per test case (and twice that for Java and Python submissions).

문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2015-2016 > US Open > Platinum

태그

평가 및 의견

Bull in a China Shop

개요
출제자 난이도 Platinum II 플래티넘 II 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

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

풀이 제출

Bull in a China Shop

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