結果

問題 No.871 かえるのうた
ユーザー Coki628Coki628
提出日時 2020-05-08 14:50:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,040 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 11,356 KB
実行使用メモリ 24,952 KB
最終ジャッジ日時 2023-09-16 08:27:11
合計ジャッジ時間 6,870 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,604 KB
testcase_01 WA -
testcase_02 AC 16 ms
8,496 KB
testcase_03 AC 16 ms
8,628 KB
testcase_04 AC 16 ms
8,600 KB
testcase_05 AC 16 ms
8,656 KB
testcase_06 WA -
testcase_07 AC 16 ms
8,552 KB
testcase_08 AC 18 ms
8,924 KB
testcase_09 AC 18 ms
9,148 KB
testcase_10 AC 17 ms
8,324 KB
testcase_11 AC 17 ms
8,876 KB
testcase_12 AC 28 ms
11,316 KB
testcase_13 AC 19 ms
9,236 KB
testcase_14 AC 84 ms
24,544 KB
testcase_15 AC 83 ms
24,480 KB
testcase_16 AC 146 ms
24,952 KB
testcase_17 AC 78 ms
23,064 KB
testcase_18 AC 28 ms
11,304 KB
testcase_19 WA -
testcase_20 AC 27 ms
9,964 KB
testcase_21 AC 50 ms
14,488 KB
testcase_22 AC 16 ms
8,204 KB
testcase_23 AC 16 ms
8,664 KB
testcase_24 AC 16 ms
8,488 KB
testcase_25 AC 19 ms
8,860 KB
testcase_26 AC 28 ms
9,964 KB
testcase_27 AC 25 ms
11,012 KB
testcase_28 AC 17 ms
8,600 KB
testcase_29 AC 49 ms
15,512 KB
testcase_30 AC 104 ms
20,552 KB
testcase_31 AC 19 ms
9,100 KB
testcase_32 AC 88 ms
18,752 KB
testcase_33 WA -
testcase_34 AC 33 ms
12,568 KB
testcase_35 AC 53 ms
18,472 KB
testcase_36 AC 69 ms
20,972 KB
testcase_37 AC 66 ms
15,544 KB
testcase_38 AC 133 ms
22,408 KB
testcase_39 WA -
testcase_40 AC 89 ms
16,292 KB
testcase_41 AC 17 ms
8,536 KB
testcase_42 AC 90 ms
16,132 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 17 ms
8,492 KB
testcase_47 AC 16 ms
8,492 KB
testcase_48 AC 17 ms
8,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7
EPS = 10 ** -10

N, K = MAP()
K -= 1
X = LIST()
A = LIST()

ok = [0] * N
ok[K] = 1
lmx = X[K] - A[K]
for i in range(K-1, -1, -1):
    if lmx <= X[i]:
        lmx = min(lmx, X[i]-A[i])
        ok[i] = 1
    else:
        break
rmx = X[K] + A[K]
for i in range(K+1, N):
    if rmx >= X[i]:
        rmx = max(rmx, X[i]+A[i])
        ok[i] = 1
    else:
        break
ans = sum(ok)
print(ans)
0