Submission #69649195


Source Code Expand

n = int(input())
A = list(map(int, input().split()))
c0 = A.count(-1)

done = set()
for a in A:
  if a in done:
    print('No')
    exit()
  if a==-1: continue
  done.add(a)

res = []
for i in range(1, n+1):
  if i not in done:
    res.append(i)

for i, a in enumerate(A):
  if a==-1:
    A[i] = res.pop()

print('Yes')
print(*A)

Submission Info

Submission Time
Task B - Find Permutation 2
User uparupaaa
Language Python (PyPy 3.10-v7.3.12)
Score 200
Code Size 351 Byte
Status AC
Exec Time 59 ms
Memory 76764 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 32
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_Yes_00.txt, 01_Yes_01.txt, 01_Yes_02.txt, 01_Yes_03.txt, 01_Yes_04.txt, 01_Yes_05.txt, 01_Yes_06.txt, 01_Yes_07.txt, 01_Yes_08.txt, 01_Yes_09.txt, 01_Yes_10.txt, 01_Yes_11.txt, 01_Yes_12.txt, 01_Yes_13.txt, 01_Yes_14.txt, 01_Yes_15.txt, 01_Yes_16.txt, 01_Yes_17.txt, 01_Yes_18.txt, 01_Yes_19.txt, 01_Yes_20.txt, 02_No_00.txt, 02_No_01.txt, 02_No_02.txt, 02_No_03.txt, 02_No_04.txt, 02_No_05.txt, 02_No_06.txt, 02_No_07.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 56 ms 76496 KiB
00_sample_01.txt AC 56 ms 76596 KiB
00_sample_02.txt AC 57 ms 76448 KiB
01_Yes_00.txt AC 56 ms 76296 KiB
01_Yes_01.txt AC 56 ms 76288 KiB
01_Yes_02.txt AC 57 ms 76440 KiB
01_Yes_03.txt AC 57 ms 76444 KiB
01_Yes_04.txt AC 56 ms 76692 KiB
01_Yes_05.txt AC 56 ms 76600 KiB
01_Yes_06.txt AC 57 ms 76764 KiB
01_Yes_07.txt AC 57 ms 76496 KiB
01_Yes_08.txt AC 58 ms 76496 KiB
01_Yes_09.txt AC 56 ms 76308 KiB
01_Yes_10.txt AC 57 ms 76556 KiB
01_Yes_11.txt AC 59 ms 76432 KiB
01_Yes_12.txt AC 58 ms 76616 KiB
01_Yes_13.txt AC 59 ms 76680 KiB
01_Yes_14.txt AC 58 ms 76456 KiB
01_Yes_15.txt AC 57 ms 76228 KiB
01_Yes_16.txt AC 57 ms 76408 KiB
01_Yes_17.txt AC 57 ms 76464 KiB
01_Yes_18.txt AC 58 ms 76212 KiB
01_Yes_19.txt AC 58 ms 76428 KiB
01_Yes_20.txt AC 56 ms 76428 KiB
02_No_00.txt AC 56 ms 76504 KiB
02_No_01.txt AC 55 ms 76332 KiB
02_No_02.txt AC 56 ms 76308 KiB
02_No_03.txt AC 56 ms 76620 KiB
02_No_04.txt AC 56 ms 76284 KiB
02_No_05.txt AC 56 ms 76580 KiB
02_No_06.txt AC 55 ms 76600 KiB
02_No_07.txt AC 57 ms 76476 KiB