| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 22 | 19 | 17 | 89.474% |
Sogang agent is participating in “Squid Game: Two Bridges”. There are two parallel bridges, A and B, each consisting of $N$ steps. Each step has a score. The player starts at the beginning and moves to the end for $N$ rounds. The player can only move forward along the bridge.
In each round, the player can either:
When the player lands on a step, the step’s score is added to the total. Unlike the original Squid Game, there is no danger of dying in this version, and the agent will always finish the game.
Specifically, the agent starts on the starting point of the left bridge (A) with an initial score of 0ドル$ and initial energy $K,ドル shown in the figure below.
Given the score sequences $A$ (for the left bridge) and $B$ (for the right bridge), and the initial energy $K,ドル determine the maximum score the Sogang agent can achieve. The agent does not have to use all of the energy—it is also possible to use none at all.
The first line contains two integers $N$ and $K,ドル the number of turns and the agent’s initial energy. $(1 \leq N \leq 100,000,円 0 \leq K \leq 4)$
The second lines contains $N$ integers, representing the left bridge's score sequence $A$. $(-1,000円 \leq A_i \leq 1,000円)$
The third line contains $N$ integers, representing the right birdge's sequence $B$. $(-1,000円 \leq B_i \leq 1,000円)$
Print a single integer: the maximum score the Sogang agent can achieve.
| 번호 | 배점 | 제한 |
|---|---|---|
| 1 | 40 | 1ドル \leq N \leq 1,000,円 K = 2$ In this subtask, all $A_i$ are equal to 0. |
| 2 | 20 | 1ドル \leq N \leq 100,000,円 K = 2$ In this subtask, all $A_i$ are equal to 0. |
| 3 | 20 | 1ドル \leq N \leq 100,000,円 0 \leq K \leq 2$ |
| 4 | 20 | 1ドル \leq N \leq 100,000,円 0 \leq K \leq 4$ |
6 2 0 0 0 0 0 0 3 -9 5 -2 8 -5
11
This example satisfies the conditions of Subtask 1, 2, 3 and 4.
6 2 0 0 0 0 0 0 -1 -2 -1 -2 -1 -2
0
This example satisfies the conditions of Subtask 1, 2, 3 and 4.
6 2 3 3 3 2 1 7 1 2 1 7 7 2
30
This example satisfies the conditions of Subtask 3 and 4.
6 4 1 9 0 6 6 6 9 1 9 1 7 3
45
This example satisfies the conditions of Subtask 4.
1 0 -5 5
-5
This example satisfies the conditions of Subtask 3 and 4.
University > 서강대학교 > CSE4152 문제해결프로그래밍실습 > 2025-2학기 중간고사 코딩 테스트 3번