結果
| 問題 |
No.360 増加門松列
|
| コンテスト | |
| ユーザー |
kuuso1
|
| 提出日時 | 2016-09-12 01:53:37 |
| 言語 | F# (F# 4.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 912 bytes |
| コンパイル時間 | 16,597 ms |
| コンパイル使用メモリ | 197,308 KB |
| 実行使用メモリ | 34,816 KB |
| 最終ジャッジ日時 | 2024-11-17 03:44:14 |
| 合計ジャッジ時間 | 17,480 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 WA * 7 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (617 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
open System
let rec insertions x = function
| [] -> [[x]]
| (y :: ys) as l -> (x::l)::(List.map (fun x -> y::x) (insertions x ys))
let rec permutations = function
| [] -> seq [ [] ]
| x :: xs -> Seq.concat (Seq.map (insertions x) (permutations xs))
let ri () = stdin.ReadLine() |> int
let ria () = stdin.ReadLine().Split() |> Array.map int
let isAscending (a:int list) =
a |> List.pairwise |> List.map (fun (x,y) -> x<y) |> List.reduce (fun s x -> s && x)
type Sol() =
member this.Solve() =
let D = ria() |> Array.toList
let permu = permutations D
let ret = Seq.tryFind (fun ar -> ((isAscending (List.take 4 ar ) && (isAscending (List.skip 4 ar ))) = true )) permu
if (Option.isSome ret) then "YES" else "NO"
|> printfn "%s"
let mySol = new Sol()
mySol.Solve()
kuuso1