QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#321658 | #7695. Double Up | ishmeal# | AC ✓ | 393ms | 18736kb | Python3 | 542b | 2024-02-05 04:27:35 | 2024-02-05 04:27:36 |
Judging History
answer
from math import log2
MAXV = 1005
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(MAXV)] for _ in range(n)]
res = 0
for i in range(n - 1, -1, -1):
dp[i][a[i]] = i
for j in range(MAXV):
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: 9ms
memory: 10056kb
input:
5 4 2 2 1 8
output:
16
result:
ok single line: '16'
Test #2:
score: 0
Accepted
time: 392ms
memory: 18656kb
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: 0
Accepted
time: 393ms
memory: 18736kb
input:
1000 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650600228229401496703205376 1267650...
output:
649037107316853453566312041152512
result:
ok single line: '649037107316853453566312041152512'
Test #4:
score: 0
Accepted
time: 11ms
memory: 10028kb
input:
1 1
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 2ms
memory: 9968kb
input:
1 2
output:
2
result:
ok single line: '2'
Test #6:
score: 0
Accepted
time: 3ms
memory: 9916kb
input:
1 4294967296
output:
4294967296
result:
ok single line: '4294967296'
Test #7:
score: 0
Accepted
time: 2ms
memory: 10004kb
input:
1 18446744073709551616
output:
18446744073709551616
result:
ok single line: '18446744073709551616'
Test #8:
score: 0
Accepted
time: 6ms
memory: 10136kb
input:
1 1267650600228229401496703205376
output:
1267650600228229401496703205376
result:
ok single line: '1267650600228229401496703205376'
Test #9:
score: 0
Accepted
time: 161ms
memory: 13300kb
input:
384 18014398509481984 72057594037927936 72057594037927936 72057594037927936 72057594037927936 72057594037927936 72057594037927936 72057594037927936 72057594037927936 72057594037927936 72057594037927936 72057594037927936 72057594037927936 72057594037927936 72057594037927936 72057594037927936 10737418...
output:
618970019642690137449562112
result:
ok single line: '618970019642690137449562112'
Test #10:
score: 0
Accepted
time: 178ms
memory: 13760kb
input:
430 36893488147419103232 128 2251799813685248 2251799813685248 2251799813685248 2251799813685248 2251799813685248 2251799813685248 2251799813685248 2251799813685248 2251799813685248 2251799813685248 2251799813685248 2251799813685248 2251799813685248 2251799813685248 2251799813685248 2251799813685248...
output:
158456325028528675187087900672
result:
ok single line: '158456325028528675187087900672'
Test #11:
score: 0
Accepted
time: 220ms
memory: 14452kb
input:
527 1099511627776 1099511627776 1099511627776 1099511627776 1099511627776 1099511627776 1099511627776 1099511627776 1099511627776 1099511627776 1099511627776 1099511627776 1099511627776 1099511627776 1099511627776 1099511627776 1099511627776 1099511627776 1099511627776 1099511627776 1099511627776 10...
output:
158456325028528675187087900672
result:
ok single line: '158456325028528675187087900672'
Test #12:
score: 0
Accepted
time: 359ms
memory: 17100kb
input:
809 1073741824 77371252455336267181195264 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 20...
output:
19807040628566084398385987584
result:
ok single line: '19807040628566084398385987584'
Test #13:
score: 0
Accepted
time: 181ms
memory: 13828kb
input:
435 618970019642690137449562112 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 65536 128 128 128 128 128 128 128 128 128 128 128 128 128 ...
output:
316912650057057350374175801344
result:
ok single line: '316912650057057350374175801344'
Test #14:
score: 0
Accepted
time: 346ms
memory: 17508kb
input:
857 4398046511104 4398046511104 4398046511104 4398046511104 4398046511104 4398046511104 4398046511104 4398046511104 4398046511104 4398046511104 4398046511104 4398046511104 4398046511104 4398046511104 4398046511104 4398046511104 4398046511104 4398046511104 4398046511104 4398046511104 4398046511104 43...
output:
1267650600228229401496703205376
result:
ok single line: '1267650600228229401496703205376'
Test #15:
score: 0
Accepted
time: 309ms
memory: 16496kb
input:
765 17592186044416 2417851639229258349412352 2417851639229258349412352 2417851639229258349412352 2417851639229258349412352 2417851639229258349412352 2417851639229258349412352 2417851639229258349412352 2417851639229258349412352 2417851639229258349412352 2417851639229258349412352 241785163922925834941...
output:
1237940039285380274899124224
result:
ok single line: '1237940039285380274899124224'
Test #16:
score: 0
Accepted
time: 48ms
memory: 11012kb
input:
122 2097152 18014398509481984 18014398509481984 18014398509481984 18014398509481984 18014398509481984 18014398509481984 18014398509481984 18014398509481984 18014398509481984 18014398509481984 18014398509481984 18014398509481984 18014398509481984 18014398509481984 18014398509481984 18014398509481984 ...
output:
10141204801825835211973625643008
result:
ok single line: '10141204801825835211973625643008'
Test #17:
score: 0
Accepted
time: 192ms
memory: 14304kb
input:
491 8192 8192 8192 8192 8192 8192 8192 8192 8192 8192 8192 8192 8192 8192 8192 8192 8192 8192 8192 8192 8192 8192 8192 8192 8192 8192 8192 8192 8192 562949953421312 9444732965739290427392 9444732965739290427392 9444732965739290427392 9444732965739290427392 9444732965739290427392 94447329657392904273...
output:
1267650600228229401496703205376
result:
ok single line: '1267650600228229401496703205376'
Test #18:
score: 0
Accepted
time: 69ms
memory: 11376kb
input:
164 549755813888 549755813888 549755813888 549755813888 549755813888 549755813888 549755813888 549755813888 549755813888 549755813888 549755813888 549755813888 549755813888 549755813888 549755813888 549755813888 549755813888 549755813888 549755813888 549755813888 549755813888 549755813888 5497558138...
output:
20282409603651670423947251286016
result:
ok single line: '20282409603651670423947251286016'