QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#714875 | #7695. Double Up | dagworth | WA | 15ms | 10696kb | Python3 | 887b | 2024-11-06 08:51:16 | 2024-11-06 08:51:16 |
Judging History
answer
input()
arr = list(int(n) for n in input().split(" "))
biggest = max(arr)
def fix():
index = 0
while index+1 < len(arr):
if arr[index] == arr[index+1]:
arr[index]*=2
arr.pop(index+1)
index-=1
index+=1
num = 1
while num < biggest:
fix()
other = -1
i = 0
while i < len(arr):
if arr[i] == num:
if other == -1:
other = i
else:
index = other
sum = 0
while index < i and sum < 2*num:
sum+=arr[index]
index+=1
if sum >= 2*num:
arr.pop(i)
arr.pop(other)
i-=2
other = -1
i+=1
if other != -1:
arr.pop(other)
num*=2
print(arr[0])
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 9ms
memory: 10696kb
input:
5 4 2 2 1 8
output:
16
result:
ok single line: '16'
Test #2:
score: -100
Wrong Answer
time: 15ms
memory: 10628kb
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:
1
result:
wrong answer 1st lines differ - expected: '512', found: '1'