結果

問題 No.43 野球の試合
ユーザー 6soukiti296soukiti29
提出日時 2017-07-29 13:03:20
言語 Nim
(2.0.2)
結果
AC  
実行時間 43 ms / 5,000 ms
コード長 873 bytes
コンパイル時間 3,117 ms
コンパイル使用メモリ 71,332 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-12 13:43:37
合計ジャッジ時間 4,009 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 43 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]

ソースコード

diff #

import sequtils,strutils
var
    N = stdin.readline.parseInt
    hyou = newSeq[string](N)
    cnt : int
    ans = 1000
    
    
proc zyuni(X : openarray[string]):int=
    var x = X[0].count("o")
    var s : set[int8]
    for i,y in X:
        if i == 0:
            continue
        if y.count("o") > x:
            s.incl(y.count("o").int8)
    return s.card + 1
    
    
for n in 0..<N:
    hyou[n] = stdin.readline
    cnt += hyou[n].count("-")
cnt = cnt div 2


for i in 0..<(1 shl cnt):
    var j = i
    var hyou2 = hyou
    for y,h in hyou2:
        for x,w in h:
            if w == '-':
                if j mod 2 == 1:
                    hyou2[y][x] = 'o'
                    hyou2[x][y] = 'x'
                else:
                    hyou2[y][x] = 'x'
                    hyou2[x][y] = 'o'
                j = j shr 1
    ans = min(ans,zyuni(hyou2))
echo ans
0