/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 15ms 2.984 MiB
#2 Accepted 67ms 3.277 MiB
#3 Accepted 67ms 3.27 MiB
#4 Accepted 70ms 3.262 MiB
#5 Accepted 67ms 3.281 MiB
#6 Accepted 72ms 3.293 MiB
#7 Wrong Answer 71ms 3.293 MiB
#8 Wrong Answer 20ms 3.012 MiB

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