結果

問題 No.43 野球の試合
ユーザー guriceringuricerin
提出日時 2020-02-06 12:49:23
言語 F#
(F# 4.0)
結果
WA  
実行時間 -
コード長 4,250 bytes
コンパイル時間 11,757 ms
コンパイル使用メモリ 193,952 KB
実行使用メモリ 31,696 KB
最終ジャッジ日時 2023-10-25 22:28:14
合計ジャッジ時間 14,470 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
31,524 KB
testcase_01 AC 69 ms
31,524 KB
testcase_02 AC 67 ms
31,528 KB
testcase_03 AC 67 ms
31,528 KB
testcase_04 AC 67 ms
31,528 KB
testcase_05 AC 66 ms
31,528 KB
testcase_06 WA -
testcase_07 AC 66 ms
31,528 KB
testcase_08 WA -
testcase_09 AC 67 ms
31,528 KB
testcase_10 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (704 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.0/publish/

ソースコード

diff #

open System
open System.Collections.Generic

#nowarn "37"

[<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

//         /             ` 、       感謝するぜ  お前と出会えた
//        /          ノノ  ヽ
//       ,     ニニ彡'⌒    /`ヽ        これまでの  全てに
//       '   ニミ ニニ彡      〈rう├--ミ
//        { { ニミ } j j jノx'ィイく  }し{\   `丶、___/ニニニ
//       j_ニニミV ハレノ x<⌒ヽ  V ヘ  \    \ニニニニニニニ
//       {xミミー'ヾ(、ル( 厶tァァく⌒ヾ}  )ハ::::::.    \ニニニニニニ
//      彡ィ'">tァ} \(`ニ彡 ノ` /ト=く   ::::::i     \ニニニニニニ
//      (   V^`こ7  _, \``ヾヽ` ノ|`ヽ ヽ l:::::|       \ニニニニニ
//          ∧  { '  ` ノ^ヽ    { ノ     !:::::|   ___ノ^ヽニニニニニニ
//       /.::::\ゝヽ. _ノヽ``ヽ, -――- 、 /:::::/ /      ̄`ヽニニニニニ
//      /.::::::::::::::::>'"ノルハヽ`/ -―- 、⌒V::::::/.// j___ノ、  ヽニニニニニ
//   /ニニ、`ヽ`ヾヘ{ {、ムイ 、_(   >  \/ (__ ノニニニ     \ニニニニ
//  ,仁ニニニ\ヽヽヽ ∨   /ニニ>彡>--')__ ノ    `ヽニ     \ニニニ二
//  ニニニニニニヽ   /     {ニニ> ´ `¨¨´         ニ}      \>''"´
//  ニニニニニニニニ/     ∨ /               }八
//  ニニニニニニニ./        }ニ{                ノニヽ     ノ
//  ニニニニニニニ/       }ニハ               /⌒ヽヽヽ ___彡
//  ニニニニニニニ!        ノニニヽ、            /     ` ー=彡'ニニニニニ
//  ニニニニニニニ}          ⌒`丶、     /⌒ヽ  ノ     ノ_____
//   / ̄ ̄ ̄`ヽ/ヽ、 _彡ヘ{ {        > 、 /     /  ̄ ̄ ̄
//      ) 、    /   ヾ、    ヽ ヽ      (    `{    /
//  // ⌒ヽ  /    〃 トミ  ___ >--‐=、   ヽ _ノ
//   {       /    //     /         \__ノ

// -----------------------------------------------------------------------------------------------------
let main() =
    let n = read int
    let table = Array2D.init n n (fun _ _ -> '.')

    for i in 0 .. n - 1 do
        let s = read string
        for j in 0 .. Seq.length s - 1 do
            table.[i, j] <- s.[j]
    for i in 0 .. n - 1 do
        if table.[0, i] = '-' then
            table.[0, i] <- 'o'
            table.[i, 0] <- 'x'

    let wins = Array.zeroCreate n

    for i in 0 .. n - 1 do
        let s = table.[i, *] |> fun c -> String(c)

        let w = s.Length - s.Replace("o", "").Length
        wins.[i] <- w

    let wins =
        wins
        |> Array.indexed
        |> Array.sortBy (fun (i, x) -> -x)

    // for i, v in wins do
    //     sprintf "i:%d, v:%d" i v |> puts

    for i in 0 .. n - 1 do
        let a, b = wins.[i]
        if a = 0 then puts (i + 1)

// -----------------------------------------------------------------------------------------------------
main()
writer.Dispose()
0