124772024-12-18 17:50:4142Következő permutáció (50 pont)pypy3Wrong answer 0/5065ms22860 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/045ms19376 KiB
2Wrong answer0/059ms22576 KiB
3Wrong answer0/143ms19524 KiB
4Wrong answer0/139ms19472 KiB
5Wrong answer0/146ms19392 KiB
6Wrong answer0/143ms19436 KiB
7Wrong answer0/239ms19492 KiB
8Wrong answer0/239ms19476 KiB
9Wrong answer0/239ms19552 KiB
10Wrong answer0/239ms19452 KiB
11Wrong answer0/146ms19444 KiB
12Wrong answer0/145ms19448 KiB
13Wrong answer0/141ms19432 KiB
14Wrong answer0/139ms19580 KiB
15Wrong answer0/348ms19712 KiB
16Wrong answer0/346ms19900 KiB
17Wrong answer0/350ms21504 KiB
18Wrong answer0/361ms21736 KiB
19Wrong answer0/364ms22496 KiB
20Wrong answer0/357ms22672 KiB
21Wrong answer0/365ms22760 KiB
22Wrong answer0/357ms22764 KiB
23Wrong answer0/356ms22840 KiB
24Wrong answer0/364ms22860 KiB
25Wrong answer0/259ms22484 KiB
26Wrong answer0/264ms22856 KiB