結果

問題 No.640 76本のトロンボーン
ユーザー kohei2019kohei2019
提出日時 2022-07-28 23:29:22
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 913 bytes
コンパイル時間 1,160 ms
コンパイル使用メモリ 86,888 KB
実行使用メモリ 78,672 KB
最終ジャッジ日時 2023-09-25 17:35:55
合計ジャッジ時間 3,709 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
71,620 KB
testcase_01 AC 87 ms
71,820 KB
testcase_02 AC 83 ms
71,476 KB
testcase_03 AC 83 ms
71,740 KB
testcase_04 AC 85 ms
71,360 KB
testcase_05 AC 86 ms
71,664 KB
testcase_06 WA -
testcase_07 AC 119 ms
78,468 KB
testcase_08 AC 135 ms
78,408 KB
testcase_09 AC 117 ms
78,084 KB
testcase_10 AC 117 ms
78,312 KB
testcase_11 AC 119 ms
78,388 KB
testcase_12 AC 118 ms
78,432 KB
testcase_13 WA -
testcase_14 AC 119 ms
78,300 KB
testcase_15 AC 86 ms
71,492 KB
testcase_16 AC 86 ms
71,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import copy
N = int(input())
lsS = [list(input()) for i in range(N)]
def rotate(ls):
    lens = len(ls)
    ret = [[0]*lens for i in range(lens)]
    for i in range(lens):
        for j in range(lens):
            ret[j][lens-1-i] = ls[i][j]
    return ret
ans = 0
for i in range(4):
    ls2 = copy.deepcopy(lsS)
    cnt = 0
    for j in range(N):
        if ls2[j][:-1].count('.') == N-1:
            cnt += 1
            for k in range(N-1):
                ls2[j][k] = '#'
        if ls2[j][1:].count('.') == N-1:
            cnt += 1
            for k in range(1,N):
                ls2[j][k] = '#'
    
    for j in range(N):
        cc = 0
        for k in range(N):
            if ls2[k][j] == '#':
                cc += 1
        if cc == 0:
            cnt += 1
        if cc == 1 and (ls2[0][j] == '#' or ls2[-1][j] == '#'):
            cnt += 1

    ans = max(ans, cnt)
    lsS = rotate(lsS)
print(ans)
0