結果
問題 | No.1051 PQ Permutation |
ユーザー | brthyyjp |
提出日時 | 2020-05-08 22:56:53 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,194 bytes |
コンパイル時間 | 2,033 ms |
コンパイル使用メモリ | 86,996 KB |
実行使用メモリ | 109,108 KB |
最終ジャッジ日時 | 2023-09-19 07:59:07 |
合計ジャッジ時間 | 14,063 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 80 ms
71,224 KB |
testcase_01 | AC | 81 ms
71,148 KB |
testcase_02 | AC | 82 ms
71,332 KB |
testcase_03 | AC | 79 ms
71,428 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 81 ms
71,356 KB |
testcase_08 | WA | - |
testcase_09 | AC | 82 ms
71,192 KB |
testcase_10 | WA | - |
testcase_11 | AC | 82 ms
71,296 KB |
testcase_12 | WA | - |
testcase_13 | AC | 81 ms
71,372 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | AC | 275 ms
91,360 KB |
testcase_36 | AC | 282 ms
91,340 KB |
testcase_37 | AC | 266 ms
108,688 KB |
testcase_38 | AC | 436 ms
108,780 KB |
testcase_39 | AC | 265 ms
108,684 KB |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | AC | 80 ms
71,608 KB |
testcase_45 | AC | 82 ms
71,160 KB |
testcase_46 | WA | - |
testcase_47 | AC | 80 ms
71,264 KB |
testcase_48 | AC | 265 ms
108,700 KB |
ソースコード
n, p, q = map(int, input().split()) A = list(map(int, input().split())) C = list(range(1, n+1)) import heapq heapq.heapify(C) B = [0]*n flag1 = False flag2 = False for i in range(n): a = A[i] temp = [] while C: x = heapq.heappop(C) if not flag2: if x <= A[i]: temp.append(x) continue else: if x != q: B[i] = x break else: if flag1: B[i] = x break else: temp.append(x) continue else: if x != q: B[i] = x break else: if flag1: B[i] = x break else: temp.append(x) continue if B[i] == 0: #print(B) print(-1) exit() if B[i] == p: flag1 = True if not flag2: if B[i] > A[i]: flag2 = True while temp: y = temp.pop() heapq.heappush(C, y) print(*B)