結果

問題 No.479 頂点は要らない
ユーザー pekempeypekempey
提出日時 2017-01-27 22:55:55
言語 F#
(F# 4.0)
結果
AC  
実行時間 234 ms / 1,500 ms
コード長 623 bytes
コンパイル時間 4,384 ms
コンパイル使用メモリ 161,884 KB
実行使用メモリ 38,044 KB
最終ジャッジ日時 2023-08-25 04:29:37
合計ジャッジ時間 10,792 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
22,292 KB
testcase_01 AC 60 ms
22,488 KB
testcase_02 AC 60 ms
24,376 KB
testcase_03 AC 60 ms
22,544 KB
testcase_04 AC 61 ms
24,340 KB
testcase_05 AC 60 ms
24,380 KB
testcase_06 AC 60 ms
22,356 KB
testcase_07 AC 61 ms
22,376 KB
testcase_08 AC 61 ms
22,464 KB
testcase_09 AC 61 ms
22,568 KB
testcase_10 AC 61 ms
22,328 KB
testcase_11 AC 61 ms
22,288 KB
testcase_12 AC 62 ms
24,432 KB
testcase_13 AC 61 ms
24,484 KB
testcase_14 AC 61 ms
22,284 KB
testcase_15 AC 60 ms
22,408 KB
testcase_16 AC 60 ms
22,448 KB
testcase_17 AC 61 ms
24,412 KB
testcase_18 AC 61 ms
22,324 KB
testcase_19 AC 64 ms
24,560 KB
testcase_20 AC 63 ms
22,380 KB
testcase_21 AC 61 ms
22,508 KB
testcase_22 AC 63 ms
22,380 KB
testcase_23 AC 63 ms
22,508 KB
testcase_24 AC 64 ms
22,632 KB
testcase_25 AC 64 ms
22,648 KB
testcase_26 AC 234 ms
38,044 KB
testcase_27 AC 226 ms
37,960 KB
testcase_28 AC 205 ms
35,896 KB
testcase_29 AC 207 ms
36,456 KB
testcase_30 AC 205 ms
34,248 KB
testcase_31 AC 205 ms
36,296 KB
testcase_32 AC 203 ms
32,256 KB
testcase_33 AC 191 ms
35,388 KB
testcase_34 AC 206 ms
33,972 KB
testcase_35 AC 212 ms
35,400 KB
testcase_36 AC 153 ms
30,684 KB
testcase_37 AC 202 ms
33,780 KB
testcase_38 AC 185 ms
34,956 KB
testcase_39 AC 145 ms
33,372 KB
testcase_40 AC 159 ms
32,148 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

open System

let N, M = Console.ReadLine().Split() |> Array.map int |> fun a -> a.[0], a.[1]

let graph : (int list) array = Array.create N []
let marked = Array.create N false

for _ in 1 .. M do
    let u, v = Console.ReadLine().Split() |> Array.map int |> fun a -> a.[0], a.[1]
    graph.[u] <- v :: graph.[u]
    graph.[v] <- u :: graph.[v]

for i in N - 1 .. -1 .. 0 do
    if graph.[i] |> List.exists (fun j -> j > i && not marked.[j]) then
        marked.[i] <- true

marked
|> Array.rev
|> Array.skipWhile (fun x -> not x)
|> Array.map (fun x -> if x then "1" else "0")
|> System.String.Concat
|> Console.WriteLine
0