Problem: You are given a sequence of length N: A_1, A_2, ..., A_N. For each integer i between 1 and N (inclusive), answer the following question:    * Find the maximum value among the N-1 elements other than A_i in the sequence.

Submission attempts (in order):
import numpy as np

S = input()
N = int(S)

A = np.zeros([N])
A_temp = np.zeros([N])

for i in range(N):
    A[i] = int(input())

max = 0

for i in range(N):
    A_temp = A
    A_temp[i] = 0
    for j in range(N):
        max_temp = A_temp[j]
        if max_temp > max:
            max = max_temp
    print(max)


import numpy as np

S = input()
N = int(S)

A = np.zeros([N])
A_temp = np.zeros([N])

for i in range(0, N, 1):
    A[i] = int(input())

max = 0

index_max = np.argmax(A)

for i in range(0, N, 1):
    A_temp = np.copy(A)
    if index_max != i:
        print(int(A_temp[index_max]))
    else:
        A_temp[i] = 0
        print(A_temp)
        print(int(np.amax(A_temp)))


import numpy as np

S = input()
N = int(S)

A = np.zeros([N])
A_temp = np.zeros([N])

for i in range(0, N, 1):
    A[i] = int(input())

max = 0

index_max = np.argmax(A)
A_temp = np.copy(A)
A_temp[index_max] = 0
index_max_second = np.argmax(A_temp)

result = np.full(N, A[index_max])
result[index_max_second] = A[index_max_second]

for i in range(0, N, 1):
    print(result[i])


import numpy as np

S = input()
N = int(S)

A = np.zeros([N])
A_temp = np.zeros([N])

for i in range(0, N, 1):
    A[i] = int(input())

max = 0

index_max = np.argmax(A)

for i in range(0, N, 1):
    if index_max != i:
        A_temp = np.copy(A)
        A_temp[i] = 0
        print(A_temp)
        print(int(np.amax(A_temp)))
    else:
        print(A_temp[index_max])


import numpy as np

S = input()
N = int(S)

A = np.zeros([N])
A_temp = np.zeros([N])

for i in range(N):
    A[i] = int(input())

max = 0

for i in range(N):
    A_temp = np.copy(A)
    A_temp[i] = 0
    print(A_temp)
    print(int(np.amax(A_temp)))


import numpy as np

S = input()
N = int(S)

A = np.zeros([N])
A_temp = np.zeros([N])

for i in range(0, N, 1):
    A[i] = int(input())

max = 0

for i in range(0, N, 1):
    A_temp = np.copy(A)
    A_temp[i] = 0
    print(A_temp)
    print(int(np.amax(A_temp)))


import numpy as np

S = input()
N = int(S)

A = np.zeros([N])
A_temp = np.zeros([N])

for i in range(0, N, 1):
    A[i] = int(input())

max = 0

index_max = np.argmax(A)
A_temp = np.copy(A)
A_temp[index_max] = 0
index_max_second = np.argmax(A)

result = np.full(N, A[index_max])
result[index_max_second] = A[index_max_second]


import numpy as np

S = input()
N = int(S)

A = np.zeros([N])
A_temp = np.zeros([N])

for i in range(N):
    A[i] = int(input())

max = 0

for i in range(N):
    A_temp = np.copy(A)
    A_temp[i] = 0
    print(A_temp)
    print(int(np.amax(A_temp)))


import numpy as np

S = input()
N = int(S)

A = np.zeros([N])
A_temp = np.zeros([N])

for i in range(0, N, 1):
    A[i] = int(input())

max = 0

index_max = np.argmax(A)
A_temp = np.copy(A)
A_temp[index_max] = 0
index_max_second = np.argmax(A_temp)

result = np.full(N, A[index_max])
result[index_max] = A[index_max_second]

for i in range(0, N, 1):
    print(int(result[i]))


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted