結果
問題 | No.905 Sorted? |
ユーザー | guricerin |
提出日時 | 2020-02-12 13:11:04 |
言語 | F# (F# 4.0) |
結果 |
AC
|
実行時間 | 484 ms / 2,000 ms |
コード長 | 1,675 bytes |
コンパイル時間 | 17,813 ms |
コンパイル使用メモリ | 202,916 KB |
実行使用メモリ | 78,932 KB |
最終ジャッジ日時 | 2024-04-14 10:59:30 |
合計ジャッジ時間 | 29,020 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 334 ms
34,744 KB |
testcase_01 | AC | 336 ms
33,944 KB |
testcase_02 | AC | 336 ms
34,160 KB |
testcase_03 | AC | 334 ms
34,072 KB |
testcase_04 | AC | 334 ms
34,484 KB |
testcase_05 | AC | 337 ms
35,532 KB |
testcase_06 | AC | 337 ms
34,524 KB |
testcase_07 | AC | 341 ms
36,004 KB |
testcase_08 | AC | 456 ms
70,036 KB |
testcase_09 | AC | 427 ms
67,780 KB |
testcase_10 | AC | 448 ms
77,168 KB |
testcase_11 | AC | 455 ms
68,480 KB |
testcase_12 | AC | 468 ms
68,216 KB |
testcase_13 | AC | 466 ms
78,876 KB |
testcase_14 | AC | 463 ms
78,932 KB |
testcase_15 | AC | 467 ms
69,952 KB |
testcase_16 | AC | 484 ms
75,552 KB |
testcase_17 | AC | 480 ms
75,204 KB |
testcase_18 | AC | 443 ms
71,048 KB |
testcase_19 | AC | 334 ms
34,608 KB |
testcase_20 | AC | 336 ms
34,636 KB |
testcase_21 | AC | 334 ms
36,672 KB |
testcase_22 | AC | 339 ms
34,328 KB |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (446 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) /home/judge/data/code/Main.fs(37,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 fs = Array.zeroCreate (n + 1) let gs = Array.zeroCreate (n + 1) for i in 0 .. n - 2 do if bs.[i] <= bs.[i + 1] then fs.[i] <- 1L if bs.[i] >= bs.[i + 1] then gs.[i] <- 1L let fcum = Array.zeroCreate (n + 1) let gcum = Array.zeroCreate (n + 1) for i in 0 .. n - 1 do fcum.[i + 1] <- fcum.[i] + fs.[i] gcum.[i + 1] <- gcum.[i] + gs.[i] let q = read int for i in 0 .. q - 1 do let [| l; r |] = reada int let diff = r - l |> int64 let okf = if fcum.[r] - fcum.[l] = diff then 1 else 0 let okg = if gcum.[r] - gcum.[l] = diff then 1 else 0 sprintf "%d %d" okf okg |> puts () // ----------------------------------------------------------------------------------------------------- main() writer.Dispose()