結果

問題 No.1913 Periodic Comparison
ユーザー chineristACchineristAC
提出日時 2022-02-06 03:31:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 795 bytes
コンパイル時間 395 ms
コンパイル使用メモリ 87,020 KB
実行使用メモリ 129,436 KB
最終ジャッジ日時 2023-09-02 06:55:52
合計ジャッジ時間 17,660 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 112 ms
74,428 KB
testcase_01 AC 111 ms
74,608 KB
testcase_02 AC 149 ms
88,504 KB
testcase_03 AC 113 ms
74,608 KB
testcase_04 AC 113 ms
74,620 KB
testcase_05 AC 112 ms
74,920 KB
testcase_06 AC 114 ms
74,916 KB
testcase_07 AC 113 ms
75,048 KB
testcase_08 AC 184 ms
97,312 KB
testcase_09 AC 290 ms
128,864 KB
testcase_10 AC 182 ms
97,604 KB
testcase_11 AC 288 ms
128,480 KB
testcase_12 AC 216 ms
128,612 KB
testcase_13 AC 183 ms
97,316 KB
testcase_14 AC 239 ms
128,156 KB
testcase_15 AC 291 ms
128,716 KB
testcase_16 WA -
testcase_17 AC 190 ms
97,532 KB
testcase_18 AC 178 ms
97,620 KB
testcase_19 AC 285 ms
128,668 KB
testcase_20 AC 226 ms
128,408 KB
testcase_21 AC 287 ms
128,736 KB
testcase_22 RE -
testcase_23 AC 175 ms
96,908 KB
testcase_24 AC 291 ms
128,716 KB
testcase_25 AC 211 ms
128,052 KB
testcase_26 AC 238 ms
128,140 KB
testcase_27 AC 181 ms
97,896 KB
testcase_28 AC 186 ms
97,540 KB
testcase_29 AC 291 ms
128,264 KB
testcase_30 RE -
testcase_31 AC 177 ms
96,780 KB
testcase_32 AC 177 ms
97,144 KB
testcase_33 WA -
testcase_34 AC 289 ms
128,560 KB
testcase_35 AC 287 ms
128,588 KB
testcase_36 AC 213 ms
128,024 KB
testcase_37 AC 290 ms
128,644 KB
testcase_38 AC 112 ms
74,808 KB
testcase_39 WA -
testcase_40 AC 276 ms
129,136 KB
testcase_41 AC 268 ms
129,300 KB
testcase_42 AC 278 ms
129,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random,bisect
from collections import deque,defaultdict


input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

N = int(input())
X = li()
Y = li()

M = max(Y)
f_inv = [-1] * (M+1)
for i in range(N):
    f_inv[Y[i]] = N * X[i] + i

deq = deque([-1]*N)
for i in range(M+1)[::-1]:
    #if not deq:
        #exit(print(-1))
    v = deq.popleft()
    if f_inv[i]==-1:
        f_inv[i] = v
    else:
        if v!=-1 and v!=f_inv[i]:
            exit(print(-1))
        elif v==-1:
            v = f_inv[i]
    
    if v==-1:
        deq.append(v)
    elif N <= v:
        deq.append(v-N)
#if deq:
    #exit(print(-1))
    
ans = [0] * N
for i in range(M+1):
    if f_inv[i] < N and f_inv[i]!=-1:
        ans[f_inv[i]] = i

print(*ans)
0