QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#523973#8768. Arrested Developmentwuxman57Compile Error//Python3470b2024-08-19 03:10:082024-08-19 03:10:08

Judging History

你现在查看的是最新测评结果

  • [2024-08-19 03:10:08]
  • 评测
  • [2024-08-19 03:10:08]
  • 提交

answer

n = int(input())

a = [0] * n
b = [0] * n

maxval = 0

for x in range(0, n);
	line = [int(i) for i in input().split(" ")]
	a[x] = line[0]
	b[x] = line[1]
	
	maxval += a[x]

dp = [float("inf")] * (maxval + 1)
	
dp[0] = 0
	
for x in range(0, n):
	for y in range(maxval, -1, -1):
		dp[y] += b[x]
		if y >= a[x]:
			dp[y] = min(dp[y], dp[y - a[x]]) 

ans = float("inf")

for x in range(0, maxval + 1):
	ans = min(ans, max(x, dp[x]))
	
print(ans)

Details

  File "answer.code", line 8
    for x in range(0, n);
                        ^
SyntaxError: invalid syntax