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

D. Chips Challenge

Unrated 레이팅 미적용
난이도
3s
시간 제한
1024MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

A prominent microprocessor company has enlisted your help to lay out some interchangeable components (widgets) on some of their computer chips. Each chip’s design is an \(N \times N\) square of slots. One slot can hold a single component, and you are to try to fit in as many widgets as possible. Modern processor designs are complex, of course. You unfortunately have several restrictions:

  • Some of the slots are disabled.

  • Some of the slots are already occupied by other components and cannot be used for widgets.

  • There are sibling memory buses connected to the horizontal and vertical edges of the chip and their bandwidth loads need to match. As such, there must be exactly as many components in the first row as in the first column, exactly as many in the second row as in the second column, and so on. Component counts include both the components already specified on the chip and the added widgets.

  • Similarly, the power supply is connected at the end of each row and column. To avoid hot spots, any given row or column must have no more than \(A/B\) of the total components on the chip for a given \(A\) and \(B\). A specification for a chip is \(N\) lines of \(N\) characters, where ‘.’ indicates an open slot, ‘/’ indicates a disabled slot, and ‘C’ indicates a slot already occupied by a component. For example: CC/.. ./.// ..C.C /.C.. /./\(C/ If\) no more than \(3/10\) of the components may be in any one row or column, the maximum number of widgets that can be added to this \(5 \times 5\) chip is 7. A possible arrangement is below, where ‘W’ indicates a widget added in an open slot. \(CC/W\). \(W/W\)// W.C.C /.C\(WW /W/C\)/

제약
입력 형식

The input consists of several test cases. Each case starts with a line containing three integers: The size of the chip \(N\) (\(1 \le N \le 40\)), and \(A\) and \(B\) (\(1 \le B \le 1000\), \(0 \le A \le B\)) as described above. Each of the following \(N\) lines contains \(N\) characters describing the slots, one of ‘.’, ‘/’ or ‘C’, as described above. The last test case is followed by a line containing three zeros.

출력 형식

For each test case, display a single line beginning with the case number. If there is a solution, display the maximum number of widgets that can be added to the chip. Display “impossible” if there is no solution. Follow the format of the sample output.

예제 1
입력
2 1 1
/.
//
2 50 100
/.
C/
2 100 100
./
C.
5 3 10
CC/..
././/
..C.C
/.C..
/./C/
5 2 10
CC/..
././/
..C.C
/.C..
/./C/
0 0 0
ICPC 2011 World Finals Problem D: Chips Challenge
출력
Case 1: 0
Case 2: 1
Case 3: impossible
Case 4: 7
Case 5: impossible
문제 정보

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

출처 ICPC World Finals 2011

평가 및 의견

D. Chips Challenge

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

Log in to rate problems.

개별 의견

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

풀이 제출

D. Chips Challenge

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