結果
問題 | No.905 Sorted? |
ユーザー | guricerin |
提出日時 | 2020-02-12 14:02:50 |
言語 | F# (F# 4.0) |
結果 |
AC
|
実行時間 | 487 ms / 2,000 ms |
コード長 | 1,556 bytes |
コンパイル時間 | 7,135 ms |
コンパイル使用メモリ | 201,596 KB |
実行使用メモリ | 78,284 KB |
最終ジャッジ日時 | 2024-04-14 21:33:51 |
合計ジャッジ時間 | 18,679 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 335 ms
34,804 KB |
testcase_01 | AC | 336 ms
34,956 KB |
testcase_02 | AC | 334 ms
34,808 KB |
testcase_03 | AC | 336 ms
34,712 KB |
testcase_04 | AC | 334 ms
34,700 KB |
testcase_05 | AC | 337 ms
34,984 KB |
testcase_06 | AC | 336 ms
34,548 KB |
testcase_07 | AC | 339 ms
35,932 KB |
testcase_08 | AC | 455 ms
69,572 KB |
testcase_09 | AC | 426 ms
66,424 KB |
testcase_10 | AC | 448 ms
76,760 KB |
testcase_11 | AC | 457 ms
67,392 KB |
testcase_12 | AC | 466 ms
66,716 KB |
testcase_13 | AC | 466 ms
78,196 KB |
testcase_14 | AC | 460 ms
78,284 KB |
testcase_15 | AC | 476 ms
68,392 KB |
testcase_16 | AC | 483 ms
73,864 KB |
testcase_17 | AC | 487 ms
74,056 KB |
testcase_18 | AC | 446 ms
70,256 KB |
testcase_19 | AC | 334 ms
34,960 KB |
testcase_20 | AC | 336 ms
34,708 KB |
testcase_21 | AC | 337 ms
35,084 KB |
testcase_22 | AC | 335 ms
34,960 KB |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (226 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) /home/judge/data/code/Main.fs(33,13): warning FS0025: この式のパターン マッチが不完全です たとえば、値 '[|_; _; _|]' はパターンに含まれないケースを示す可能性があります。 [/home/judge/data/code/main.fsproj] main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
open System open System.Collections.Generic [<AutoOpen>] module Cin = let read f = stdin.ReadLine() |> f let reada f = stdin.ReadLine().Split() |> Array.map f let readChars() = read string |> Seq.toArray let readInts() = readChars() |> Array.map (fun x -> Convert.ToInt32(x.ToString())) [<AutoOpen>] module Cout = let writer = new IO.StreamWriter(new IO.BufferedStream(Console.OpenStandardOutput())) let print (s: string) = writer.Write s let println (s: string) = writer.WriteLine s let inline puts (s: ^a) = string s |> println // ----------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------- let main() = let n = read int let bs = reada int64 let bs = Array.append bs [| (Array.last bs) |] let fs = Array.zeroCreate (n + 1) let gs = Array.zeroCreate (n + 1) for i in 0 .. n - 1 do fs.[i + 1] <- fs.[i] + if bs.[i] <= bs.[i + 1] then 1 else 0 gs.[i + 1] <- gs.[i] + if bs.[i] >= bs.[i + 1] then 1 else 0 let q = read int for i in 0 .. q - 1 do let [| l; r |] = reada int let diff = r - l let okf = if fs.[r] - fs.[l] = diff then 1 else 0 let okg = if gs.[r] - gs.[l] = diff then 1 else 0 sprintf "%d %d" okf okg |> puts () // ----------------------------------------------------------------------------------------------------- main() writer.Dispose()