結果

問題 No.871 かえるのうた
ユーザー tktk_snsntktk_snsn
提出日時 2021-02-07 19:32:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 486 bytes
コンパイル時間 1,286 ms
コンパイル使用メモリ 86,560 KB
実行使用メモリ 103,892 KB
最終ジャッジ日時 2023-09-17 17:57:04
合計ジャッジ時間 8,526 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
70,932 KB
testcase_01 WA -
testcase_02 AC 66 ms
71,260 KB
testcase_03 AC 67 ms
71,180 KB
testcase_04 AC 67 ms
71,308 KB
testcase_05 AC 67 ms
71,160 KB
testcase_06 WA -
testcase_07 AC 67 ms
71,308 KB
testcase_08 AC 70 ms
75,860 KB
testcase_09 AC 71 ms
75,820 KB
testcase_10 AC 75 ms
75,564 KB
testcase_11 AC 71 ms
75,528 KB
testcase_12 AC 78 ms
79,060 KB
testcase_13 AC 72 ms
75,528 KB
testcase_14 AC 124 ms
101,544 KB
testcase_15 AC 125 ms
102,000 KB
testcase_16 AC 133 ms
103,892 KB
testcase_17 AC 121 ms
98,164 KB
testcase_18 AC 78 ms
80,024 KB
testcase_19 WA -
testcase_20 AC 77 ms
76,680 KB
testcase_21 AC 100 ms
90,088 KB
testcase_22 AC 68 ms
71,076 KB
testcase_23 AC 68 ms
71,260 KB
testcase_24 AC 68 ms
71,264 KB
testcase_25 AC 75 ms
76,184 KB
testcase_26 AC 77 ms
76,276 KB
testcase_27 AC 75 ms
76,604 KB
testcase_28 AC 67 ms
71,072 KB
testcase_29 AC 95 ms
97,860 KB
testcase_30 AC 113 ms
96,144 KB
testcase_31 AC 70 ms
75,464 KB
testcase_32 AC 110 ms
96,708 KB
testcase_33 WA -
testcase_34 AC 80 ms
82,216 KB
testcase_35 AC 102 ms
98,280 KB
testcase_36 AC 115 ms
95,816 KB
testcase_37 AC 101 ms
92,240 KB
testcase_38 AC 127 ms
99,164 KB
testcase_39 WA -
testcase_40 AC 98 ms
98,112 KB
testcase_41 AC 68 ms
71,272 KB
testcase_42 AC 98 ms
98,112 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 70 ms
71,204 KB
testcase_47 AC 67 ms
71,208 KB
testcase_48 AC 67 ms
70,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K = map(int, input().split())
inf = float("inf")
X = [-inf] + list(map(int, input().split())) + [inf]
A = [-1] + list(map(int, input().split())) + [inf]

ans = [0] * (N + 2)

# left
L = X[K]
i = K
while i > 0:
    if X[i] >= L:
        ans[i] = 1
        L = min(L, X[i] - A[i])
        i -= 1
    else:
        break

# right
R = X[K]
i = K
while i < N + 1:
    if X[i] <= R:
        ans[i] = 1
        R = max(R, X[i] + A[i])
        i += 1
    else:
        break

print(sum(ans))
0