QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#321657#7695. Double Upishmeal#WA 59ms11000kbPython3527b2024-02-05 04:26:152024-02-05 04:26:16

Judging History

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

  • [2024-02-05 04:26:16]
  • 评测
  • 测评结果:WA
  • 用时:59ms
  • 内存:11000kb
  • [2024-02-05 04:26:15]
  • 提交

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)
        


Details

Tip: Click on the bar to expand more detailed information

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'