Submission #1185513
Source Code Expand
A,B = list(map(int,input().split())) a = list(map(int,input().split())) b = list(map(int,input().split())) # A,B = 4,4 # a = [2,4,5,4] # b = [2,8,3,4] # A,B = 1,3 # a = [1] # b = [2,9,9] # dp[i][j] = 左からi右からjとったときの最高点 dp = [[0 for j in range(B+1)] for i in range(A+1)] for i in range(A)[::-1]: if (A-i)%2 == 0: dp[i][B] = dp[i+1][B] + a[i] else: dp[i][B] = dp[i+1][B] for j in range(B)[::-1]: if (B-j)%2 == 0: dp[A][j] = dp[A][j+1] + b[j] else: dp[A][j] = dp[A][j+1] for i in range(A)[::-1]: for j in range(B)[::-1]: if (i+j)%2 == 0: dp[i][j] = max(dp[i+1][j]+a[i], dp[i][j+1]+b[j]) else: dp[i][j] = min(dp[i+1][j], dp[i][j+1]) print(dp[0][0])
Submission Info
Submission Time | |
---|---|
Task | B - ゲーム |
User | chahan69 |
Language | Python (3.4.3) |
Score | 0 |
Code Size | 751 Byte |
Status | WA |
Exec Time | 783 ms |
Memory | 27844 KB |
Judge Result
Set Name | All | ||||
---|---|---|---|---|---|
Score / Max Score | 0 / 3 | ||||
Status |
|
Set Name | Test Cases |
---|---|
All | 00, 01, 02, 90, 91 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00 | AC | 17 ms | 3064 KB |
01 | WA | 552 ms | 19516 KB |
02 | AC | 783 ms | 27844 KB |
90 | WA | 17 ms | 3064 KB |
91 | AC | 17 ms | 3064 KB |