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

32971번 - Karte 서브태스크다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB39141437.838%

문제

On Vito’s table, there are $N$ red cards labeled with numbers from 1ドル$ to $N$ and $M$ blue cards labeled with numbers from 1ドル$ to $M$. Each pair of red and blue cards $(c, p)$ (where $c$ represents a red card and $p$ a blue card) can create a COMBO move.

The strength of a deck of cards is defined as:

strength = (number of COMBO moves) - $X$ · (number of red cards) − $Y$ · (number of blue cards)

where the number of COMBO moves is the number of pairs $(c, p)$ such that the red card $c$ and the blue card $p$ are in the chosen deck. Vito can include any card from the table in his deck. Help Vito find the value of the strongest deck he can build. Vito can also choose an empty deck of cards.

입력

The first line contains 4ドル$ natural numbers $N,ドル $M,ドル $X,ドル $Y$ (1ドル ≤ N, M ≤ 21,ドル 0ドル ≤ X, Y ≤ 30$).

In the next $N$ lines, there is a sequence of $$M characters (0ドル$ or 1ドル$), where the $j$-th character indicates whether the $i$-th red card and the $j$-th blue card create a COMBO move.

출력

In the first and only line, output the value of the strongest deck of cards that Vito can build.

제한

서브태스크

번호배점제한
118

$Y = 0$

211

1ドル ≤ N, M ≤ 9$

324

1ドル ≤ N, M ≤ 15$

417

No additional constraints.

예제 입력 1

2 2 0 0
11
10

예제 출력 1

3

예제 입력 2

3 3 1 0
111
111
000

예제 출력 2

4

예제 입력 3

3 3 1 1
111
101
011

예제 출력 3

1

힌트

Explanation of the first sample case: Vito will choose all the cards from the table, creating 3ドル$ COMBO moves.

Explanation of the second sample case: Vito will select the first 2ドル$ red cards and all 3ドル$ blue cards, creating 6ドル$ COMBO moves. The deck strength is 4ドル$ because Vito selected $2ドル red cards, so the number of COMBO moves, i.e., 6ドル,ドル is reduced by 2ドル$.

출처

Contest > Croatian Open Competition in Informatics > COCI 2024/2025 > Contest #3 2번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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