124762024-12-18 17:47:5642Következő permutáció (50 pont)python3Wrong answer 0/5025ms4524 KiB
import sys
input=sys.stdin.readline
def solv():
 N=int(input())
 A=[int(x) for x in input().split()]
 last=N-1
 while A[last-1]>A[last]:last-=1
 j=N-1
 while A[j]<A[last-1]:j-=1
 print(*A[:last-1],A[j],A[last-1],*A[j+1:],*A[last:j][::-1],end='\r\n')    
solv()

SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/016ms3320 KiB
2Wrong answer0/019ms3880 KiB
3Wrong answer0/116ms3124 KiB
4Wrong answer0/116ms3128 KiB
5Wrong answer0/116ms3320 KiB
6Wrong answer0/116ms3128 KiB
7Wrong answer0/216ms3140 KiB
8Wrong answer0/216ms3128 KiB
9Wrong answer0/216ms3000 KiB
10Wrong answer0/216ms3084 KiB
11Wrong answer0/116ms3120 KiB
12Wrong answer0/116ms3044 KiB
13Wrong answer0/116ms3132 KiB
14Wrong answer0/116ms3128 KiB
15Wrong answer0/316ms3360 KiB
16Wrong answer0/316ms3128 KiB
17Wrong answer0/316ms3060 KiB
18Wrong answer0/317ms3428 KiB
19Wrong answer0/320ms4048 KiB
20Wrong answer0/320ms4148 KiB
21Wrong answer0/321ms4152 KiB
22Wrong answer0/323ms4412 KiB
23Wrong answer0/321ms4524 KiB
24Wrong answer0/321ms4516 KiB
25Wrong answer0/225ms4360 KiB
26Wrong answer0/221ms4500 KiB