/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 20ms 3.066 MiB
#2 Accepted 114ms 3.27 MiB
#3 Accepted 114ms 3.273 MiB
#4 Accepted 119ms 3.262 MiB
#5 Accepted 111ms 3.273 MiB
#6 Accepted 112ms 3.238 MiB
#7 Wrong Answer 119ms 3.297 MiB
#8 Wrong Answer 29ms 3.168 MiB
#9 Wrong Answer 24ms 3.148 MiB
#10 Wrong Answer 106ms 3.301 MiB
#11 Wrong Answer 24ms 3.008 MiB
#12 Wrong Answer 54ms 3.215 MiB
#13 Wrong Answer 132ms 3.188 MiB
#14 Wrong Answer 113ms 3.184 MiB
#15 Wrong Answer 103ms 3.301 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-10-03 13:28:44
Judged By
Score
30
Total Time
132ms
Peak Memory
3.301 MiB