結果

問題 No.808 Kaiten Sushi?
ユーザー tktk_snsntktk_snsn
提出日時 2021-02-06 11:33:58
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 680 bytes
コンパイル時間 360 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 110,176 KB
最終ジャッジ日時 2023-09-15 15:52:38
合計ジャッジ時間 11,305 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,464 KB
testcase_01 AC 68 ms
71,272 KB
testcase_02 AC 68 ms
71,524 KB
testcase_03 AC 68 ms
71,456 KB
testcase_04 AC 70 ms
71,408 KB
testcase_05 AC 68 ms
71,568 KB
testcase_06 AC 70 ms
71,412 KB
testcase_07 AC 82 ms
76,760 KB
testcase_08 AC 82 ms
76,780 KB
testcase_09 AC 82 ms
76,648 KB
testcase_10 AC 85 ms
76,828 KB
testcase_11 AC 83 ms
76,920 KB
testcase_12 AC 83 ms
76,648 KB
testcase_13 AC 85 ms
76,632 KB
testcase_14 AC 78 ms
76,844 KB
testcase_15 AC 82 ms
76,724 KB
testcase_16 AC 85 ms
76,944 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 74 ms
75,212 KB
testcase_21 AC 70 ms
71,384 KB
testcase_22 AC 73 ms
75,260 KB
testcase_23 AC 105 ms
91,308 KB
testcase_24 AC 99 ms
87,252 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 142 ms
109,852 KB
testcase_33 AC 114 ms
88,780 KB
testcase_34 AC 119 ms
92,876 KB
testcase_35 AC 121 ms
95,244 KB
testcase_36 AC 109 ms
89,036 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 135 ms
105,828 KB
testcase_40 AC 95 ms
83,040 KB
testcase_41 AC 97 ms
84,404 KB
testcase_42 AC 134 ms
99,940 KB
testcase_43 AC 106 ms
88,824 KB
testcase_44 AC 115 ms
93,380 KB
testcase_45 AC 103 ms
88,744 KB
testcase_46 AC 96 ms
81,480 KB
testcase_47 AC 139 ms
110,172 KB
testcase_48 AC 140 ms
110,072 KB
testcase_49 AC 140 ms
110,164 KB
testcase_50 AC 139 ms
109,960 KB
testcase_51 AC 139 ms
110,176 KB
testcase_52 WA -
testcase_53 WA -
testcase_54 AC 69 ms
71,144 KB
testcase_55 AC 72 ms
71,272 KB
testcase_56 AC 70 ms
71,152 KB
testcase_57 AC 100 ms
89,212 KB
testcase_58 AC 110 ms
93,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def merge(x, y):
    x.reverse()
    y.reverse()
    res = []
    while x and y:
        if x[-1] < y[-1]:
            res.append(x.pop())
        else:
            res.append(~y.pop())
    while x:
        res.append(x.pop())
    while y:
        res.append(~y.pop())
    return res


N, L = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = merge(A, B)

p = 0
D = [-1] * (2 * N)
for i, c in enumerate(C):
    if c >= 0:
        p += 1
    else:
        p -= 1
    D[i] = p

m = min(D)
D = [d - m for d in D]

loop = max(D) - 1
walk = -1
for c, d in zip(C, D):
    if c < 0 and d == loop:
        walk = ~c
print(L*loop + walk)
0