結果

問題 No.1020 Reverse
ユーザー iwotiwot
提出日時 2020-06-19 21:17:05
言語 F#
(F# 4.0)
結果
TLE  
実行時間 -
コード長 376 bytes
コンパイル時間 3,312 ms
コンパイル使用メモリ 165,632 KB
実行使用メモリ 31,028 KB
最終ジャッジ日時 2023-09-16 13:02:32
合計ジャッジ時間 8,126 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
27,408 KB
testcase_01 AC 85 ms
23,036 KB
testcase_02 AC 83 ms
22,932 KB
testcase_03 AC 240 ms
31,028 KB
testcase_04 AC 83 ms
22,912 KB
testcase_05 AC 257 ms
29,000 KB
testcase_06 AC 109 ms
24,952 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

/home/judge/data/code/Main.fs(1,5): warning FS0025: Incomplete pattern matches on this expression. For example, the value '[|_; _; _|]' may indicate a case not covered by the pattern(s).

ソースコード

diff #

let [| N; K |] = stdin.ReadLine().Split(' ') |> Array.map int
let S = stdin.ReadLine().Trim()

let reverse i j (s:string) =
    let s2 = s.[i..j] |> Seq.toList |> Seq.rev |> System.String.Concat
    let max = s.Length
    let r1 = s.[0..i-1]
    let r2 = s.[j+1 ..]
    r1 + s2 + r2

let mutable r = S
for i in 1 .. (N-K+1) do
    r <- reverse (i-1) (i+K-2) r

printfn "%s" r
0