結果

問題 No.455 冬の大三角
ユーザー pekempeypekempey
提出日時 2017-01-27 19:48:56
言語 F#
(F# 4.0)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 798 bytes
コンパイル時間 4,627 ms
コンパイル使用メモリ 156,204 KB
実行使用メモリ 24,572 KB
最終ジャッジ日時 2023-09-12 10:03:18
合計ジャッジ時間 11,691 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
22,560 KB
testcase_01 AC 68 ms
22,424 KB
testcase_02 AC 67 ms
22,440 KB
testcase_03 AC 67 ms
22,472 KB
testcase_04 AC 66 ms
22,424 KB
testcase_05 AC 67 ms
24,472 KB
testcase_06 AC 67 ms
20,484 KB
testcase_07 AC 67 ms
22,440 KB
testcase_08 AC 71 ms
20,392 KB
testcase_09 AC 69 ms
24,476 KB
testcase_10 AC 68 ms
22,332 KB
testcase_11 AC 67 ms
22,476 KB
testcase_12 AC 68 ms
22,572 KB
testcase_13 AC 67 ms
22,420 KB
testcase_14 AC 70 ms
22,332 KB
testcase_15 AC 68 ms
22,480 KB
testcase_16 AC 68 ms
24,440 KB
testcase_17 AC 67 ms
24,472 KB
testcase_18 AC 68 ms
22,512 KB
testcase_19 AC 67 ms
22,376 KB
testcase_20 AC 67 ms
22,396 KB
testcase_21 AC 67 ms
24,384 KB
testcase_22 AC 66 ms
20,432 KB
testcase_23 AC 66 ms
24,540 KB
testcase_24 AC 66 ms
22,416 KB
testcase_25 AC 67 ms
22,344 KB
testcase_26 AC 66 ms
20,308 KB
testcase_27 AC 66 ms
20,460 KB
testcase_28 AC 68 ms
22,396 KB
testcase_29 AC 69 ms
24,552 KB
testcase_30 AC 70 ms
24,508 KB
testcase_31 AC 69 ms
22,480 KB
testcase_32 AC 69 ms
24,444 KB
testcase_33 AC 72 ms
24,452 KB
testcase_34 AC 68 ms
24,500 KB
testcase_35 AC 70 ms
22,444 KB
testcase_36 AC 70 ms
22,448 KB
testcase_37 AC 71 ms
24,392 KB
testcase_38 AC 71 ms
22,448 KB
testcase_39 AC 71 ms
22,528 KB
testcase_40 AC 70 ms
22,460 KB
testcase_41 AC 70 ms
24,500 KB
testcase_42 AC 70 ms
24,528 KB
testcase_43 AC 69 ms
22,400 KB
testcase_44 AC 69 ms
22,572 KB
testcase_45 AC 70 ms
24,504 KB
testcase_46 AC 70 ms
24,472 KB
testcase_47 AC 69 ms
22,352 KB
testcase_48 AC 71 ms
22,440 KB
testcase_49 AC 68 ms
22,416 KB
testcase_50 AC 67 ms
22,484 KB
testcase_51 AC 69 ms
22,396 KB
testcase_52 AC 68 ms
22,408 KB
testcase_53 AC 69 ms
24,572 KB
testcase_54 AC 68 ms
22,392 KB
testcase_55 AC 69 ms
22,464 KB
testcase_56 AC 68 ms
22,440 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

let findPos (S : (char array) array) H W = 
    [for i in 0 .. H - 1 do for j in 0 .. W - 1 -> (i, j)]
    |> List.filter (fun (y, x) -> S.[y].[x] = '*')

let cross y1 x1 y2 x2 = y1 * x2 - y2 * x1

let isParallel y1 x1 y2 x2 y3 x3 = cross (y2 - y1) (x2 - x1) (y3 - y1) (x3 - x1) = 0
                
let H, W = System.Console.ReadLine().Split() |> Array.map int |> fun a -> a.[0], a.[1]
let S = [|for i in 1 .. H -> System.Console.ReadLine().ToCharArray()|]

let (y1, x1), (y2, x2) = findPos S H W |> Array.ofList |> fun a -> a.[0], a.[1]
let y3, x3 =
    [for i in 0 .. H - 1 do for j in 0 .. W - 1 -> (i, j)]
    |> List.filter (fun (y, x) -> not (isParallel y x y1 x1 y2 x2))
    |> List.head

S.[y3].[x3] <- '*'

S |> Array.iter (fun s -> s |> System.String.Concat |> System.Console.WriteLine)
0