Wrong Answer
Code
def max_possible_number(N, K, A):
A = list(map(str, A))
for _ in range(K):
max_num = ''
index = -1
for i in range(N-1):
new_num = A[i] + A[i+1]
if new_num > max_num:
max_num = new_num
index = i
if index == -1:
break
A[index] = max_num
A.pop(index+1)
N -= 1
return max(A)
# input
T = int(input())
for _ in range(T):
N, K = map(int, input().split())
A = list(map(int, input().split()))
print(max_possible_number(N, K, A))
Information
- Submit By
- Type
- Submission
- Problem
- P1083 Number concatenation
- Contest
- Bangladesh 2.0
- Language
- Python 3 (Python 3.12.3)
- Submit At
- 2024-08-16 16:05:04
- Judged At
- 2024-11-11 03:16:12
- Judged By
- Score
- 30
- Total Time
- 72ms
- Peak Memory
- 3.293 MiB