QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#321657 | #7695. Double Up | ishmeal# | WA | 59ms | 11000kb | Python3 | 527b | 2024-02-05 04:26:15 | 2024-02-05 04:26:16 |
Judging History
answer
from math import log2
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
a[i] = int(log2(a[i]))
dp = [[n for _ in range(105)] for _ in range(n)]
res = 0
for i in range(n - 1, -1, -1):
dp[i][a[i]] = i
for j in range(105):
if (i < n - 1):
dp[i][j] = min(dp[i][j], dp[i + 1][j])
if (dp[i][j - 1] + 1 < n):
dp[i][j] = min(dp[i][j], dp[dp[i][j - 1] + 1][j - 1])
if (dp[i][j] < n):
res = max(res, j)
res = 2 ** res
print(res)
详细
Test #1:
score: 100
Accepted
time: 12ms
memory: 10016kb
input:
5 4 2 2 1 8
output:
16
result:
ok single line: '16'
Test #2:
score: 0
Accepted
time: 59ms
memory: 10960kb
input:
1000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
512
result:
ok single line: '512'
Test #3:
score: -100
Wrong Answer
time: 48ms
memory: 11000kb
input:
1000 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650...
output:
20282409603651670423947251286016
result:
wrong answer 1st lines differ - expected: '649037107316853453566312041152512', found: '20282409603651670423947251286016'