Submission #41278869


Source Code Expand

input()
A=list(map(int,input().split()))

while True:
  if all(abs(A[i]-A[i+1])==1 for i in range(len(A)-1)):
    break
  for i in range(len(A)-1):
    if abs(A[i]-A[i+1])!=1:
      if A[i]<A[i+1]:
        A[i+1:i+1]=list(range(A[i]+1,A[i+1]))
      elif A[i]>A[i+1]:
        A[i+1:i+1]=list(range(A[i]-1,A[i+1],-1))
      break

print(*A)

Submission Info

Submission Time
Task B - Fill the Gaps
User kyopro_friends
Language PyPy3 (7.3.0)
Score 200
Code Size 353 Byte
Status AC
Exec Time 99 ms
Memory 74480 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 10
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
random_01.txt AC 99 ms 74288 KiB
random_02.txt AC 72 ms 74324 KiB
random_03.txt AC 77 ms 74104 KiB
random_04.txt AC 79 ms 74048 KiB
random_05.txt AC 79 ms 74204 KiB
random_06.txt AC 83 ms 74480 KiB
random_07.txt AC 48 ms 61912 KiB
random_08.txt AC 48 ms 61720 KiB
sample_01.txt AC 53 ms 61712 KiB
sample_02.txt AC 47 ms 61936 KiB