QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#714879 | #7695. Double Up | dagworth | WA | 7ms | 10648kb | Python3 | 914b | 2024-11-06 08:54:28 | 2024-11-06 08:54:28 |
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):
print(arr)
if arr[index] == arr[index+1]:
arr[index]*=2
arr.pop(index+1)
index-=2
index+=1
fix()
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: 0
Wrong Answer
time: 7ms
memory: 10648kb
input:
5 4 2 2 1 8
output:
[4, 2, 2, 1, 8] [4, 2, 2, 1, 8] [4, 4, 1, 8] [8, 1, 8] [1, 16] [1, 16] [1, 16] [1, 16] 16
result:
wrong answer 1st lines differ - expected: '16', found: '[4, 2, 2, 1, 8]'