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

Lovci

설명

Mirko drew a \(2 \times N\) by \(2 \times N\) chessboard and decided to play the following game:
On each square, he inscribed an integer denoting the value of that square. In the middle of the first
row (columns N and \(N+1\)), he placed two bishops. Mirko now calculates the lines of sight of the two
bishops: these are squares on the same diagonal as one of the bishops, but not on the square covered
by any of the bishops.
For instance, if N is 3, the squares within the line of sight of the two bishops (denoted by 'X') at their
starting positions (denoted by 'L') are as follows:
OOLLOO
OXXXXO
XXOOXX
XOOOOX
OOOOOO
OOOOOO
In a limited number of moves, Mirko tries to gain the maximum score by the following strategy:
1 Before making any moves, Mirko calculates the sum of the values on squares within the lines of sight
of the two bishops. That is Mirko's initial score.
2 On each turn, Mirko chooses one of the bishops and moves it to a square within its line of sight
3 On its new position, the bishop can now see new squares. The sum of those squares, previously
unseen by any of the bishops from the start of the game, is now added to Mirko's score.
Write a program which calculates the maximum score that Mirko can achieve in K turns.
INPUT DATA
The first line of input contains two integers N i K (\(1 \le N \le 10\), \(0 \le K \le 100\)), the dimension of the
chessboard and the number of turns.
The following \(2 \times N\) lines contain the values of the squares in the corresponding row, \(2 \times N\) values per
row. Those values are integers from ran\(ge -1\,000\,000\) to 1 000 000, inclusive.
OUTPUT DATA
In a single line of output, print the maximum score that Mirko can achieve.
\(8^{th}\) round, May \(14^{th}\), 2011
SCORING
In test cases worth a total of 40% points, K will be less or equal to 5.
EXAMPLE TEST DATA

제약
입력 형식

2 0
\(0 -9 -9\ 0\)
0 1 1 0
1 0 0 1
0 0 6 0

출력 형식

4
input
2 1
\(0 -9 -9\ 0\)
0 1 1 0
1 0 0 1
0 0 6 0
output
1

예제 1
입력
2 0
0 -9 -9 0
0 1 1 0
1 0 0 1
0 0 6 0
출력
4
예제 2
입력
2 1
0 -9 -9 0
0 1 1 0
1 0 0 1
0 0 6 0
출력
1
문제 정보

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

출처 COI 2011

평가 및 의견

Lovci

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

Log in to rate problems.

개별 의견

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

풀이 제출

Lovci

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