結果

問題 No.871 かえるのうた
ユーザー ducktailducktail
提出日時 2019-10-03 14:02:43
言語 Scheme
(Gauche-0.9.14)
結果
WA  
実行時間 -
コード長 743 bytes
コンパイル時間 223 ms
コンパイル使用メモリ 6,812 KB
実行使用メモリ 27,044 KB
最終ジャッジ日時 2024-04-14 09:08:49
合計ジャッジ時間 7,649 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
16,512 KB
testcase_01 WA -
testcase_02 AC 29 ms
16,512 KB
testcase_03 AC 29 ms
16,512 KB
testcase_04 AC 28 ms
16,512 KB
testcase_05 AC 28 ms
16,512 KB
testcase_06 WA -
testcase_07 AC 28 ms
16,512 KB
testcase_08 AC 39 ms
17,152 KB
testcase_09 AC 40 ms
17,152 KB
testcase_10 AC 29 ms
16,768 KB
testcase_11 AC 31 ms
16,896 KB
testcase_12 AC 75 ms
20,736 KB
testcase_13 AC 42 ms
17,280 KB
testcase_14 AC 283 ms
24,320 KB
testcase_15 AC 283 ms
24,320 KB
testcase_16 AC 309 ms
24,320 KB
testcase_17 AC 252 ms
24,192 KB
testcase_18 AC 77 ms
20,864 KB
testcase_19 WA -
testcase_20 AC 53 ms
17,920 KB
testcase_21 AC 131 ms
21,120 KB
testcase_22 AC 29 ms
16,512 KB
testcase_23 AC 30 ms
16,640 KB
testcase_24 AC 29 ms
16,512 KB
testcase_25 AC 39 ms
17,280 KB
testcase_26 AC 50 ms
18,432 KB
testcase_27 AC 57 ms
19,840 KB
testcase_28 AC 29 ms
16,512 KB
testcase_29 AC 133 ms
24,156 KB
testcase_30 AC 193 ms
24,892 KB
testcase_31 AC 41 ms
17,024 KB
testcase_32 AC 166 ms
24,064 KB
testcase_33 WA -
testcase_34 AC 85 ms
20,736 KB
testcase_35 AC 153 ms
24,020 KB
testcase_36 AC 209 ms
25,000 KB
testcase_37 AC 138 ms
21,120 KB
testcase_38 AC 262 ms
25,064 KB
testcase_39 WA -
testcase_40 AC 135 ms
24,064 KB
testcase_41 AC 29 ms
16,512 KB
testcase_42 AC 135 ms
24,172 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 28 ms
16,512 KB
testcase_47 AC 28 ms
16,512 KB
testcase_48 AC 29 ms
16,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

(define (solve n k vx va)
  (- (let loop ([r (+ (vector-ref vx (- k 1)) (vector-ref va (- k 1)))]
                [i k])
       (cond [(= i n) (- n 1)]
             [(< r (vector-ref vx i)) (- i 1)]
             [else (loop (max r (+ (vector-ref vx i) (vector-ref va i))) (+ i 1))]))
     (let loop ([r (- (vector-ref vx (- k 1)) (vector-ref va (- k 1)))]
                [i (- k 2)])
       (cond [(= i -1) 0]
             [(> r (vector-ref vx i)) (+ i 1)]
             [else (loop (min r (- (vector-ref vx i) (vector-ref va i))) (- i 1))]))
     -1))

(define (main args)
  (let* ([n (read)]
         [k (read)]
         [vx (vector-tabulate n (^_ (read)))]
         [va (vector-tabulate n (^_ (read)))])
    (print (solve n k vx va)))
  0)
0