結果

問題 No.640 76本のトロンボーン
ユーザー ミドリムシミドリムシ
提出日時 2018-01-26 23:14:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,575 bytes
コンパイル時間 644 ms
コンパイル使用メモリ 69,596 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-08-27 19:45:48
合計ジャッジ時間 1,404 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,376 KB
testcase_03 WA -
testcase_04 AC 2 ms
4,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
using namespace std;

int main(){
    int N;
    cin >> N;
    string space[N];
    for(int i = 0; i < N; i++){
        cin >> space[i];
    }
    int candidate_for_ans[6] = {0, 0, 0, 0, 0, 0};
    for(int i = 0; i < 2; i++){
        for(int j = 0; j < N; j++){
            bool if_can_push_trombone = true;
            for(int k = !i; k < N - i; k++){
                if(space[j][k] == '#'){
                    if_can_push_trombone = false;
                    break;
                }
            }
            candidate_for_ans[i] += if_can_push_trombone;
        }
        bool if_can_push_trombone_in_edge = true;
        for(int j = 1; j < N - 1; j++){
            if(space[i * (N - 1)][j] == '#'){
                if_can_push_trombone_in_edge = false;
                break;
            }
        }
        candidate_for_ans[i] += if_can_push_trombone_in_edge * (space[i * (N - 1)][0] != '#' || space[i * (N - 1)][N - 1] != '#');
    }
    for(int i = 0; i < N; i++){
        bool if_can_push_trombone = true;
        for(int j = 1; j < N - 1; j++){
            if(space[i][j] == '#'){
                if_can_push_trombone = false;
                break;
            }
        }
        candidate_for_ans[2] += if_can_push_trombone * (space[i][0] != '#' || space[i][N - 1] != '#');
    }
    for(int i = 0; i < 2; i++){
        for(int j = 0; j < N; j++){
            bool if_can_push_trombone = true;
            for(int k = !i; k < N - i; k++){
                if(space[k][j] == '#'){
                    if_can_push_trombone = false;
                    break;
                }
            }
            candidate_for_ans[i + 3] += if_can_push_trombone;
        }
        bool if_can_push_trombone_in_edge = true;
        for(int j = 1; j < N - 1; j++){
            if(space[j][i * (N - 1)] == '#'){
                if_can_push_trombone_in_edge = false;
                break;
            }
        }
        candidate_for_ans[i + 3] += if_can_push_trombone_in_edge * (space[0][i * (N - 1)] != '#' || space[N - 1][i * (N - 1)] != '#');
    }
    for(int i = 0; i < N; i++){
        bool if_can_push_trombone = true;
        for(int j = 1; j < N - 1; j++){
            if(space[j][i] == '#'){
                if_can_push_trombone = false;
                break;
            }
        }
        candidate_for_ans[5] += if_can_push_trombone * (space[0][i] != '#' || space[N - 1][i] != '#');
    }
    int ans = 0;
    for(int i = 0; i < 6; i++){
        ans = max(ans, candidate_for_ans[i]);
    }
    cout << ans << endl;
}
0