結果

問題 No.640 76本のトロンボーン
ユーザー mamekinmamekin
提出日時 2018-01-26 22:41:41
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,744 bytes
コンパイル時間 967 ms
コンパイル使用メモリ 104,240 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-08-27 19:27:06
合計ジャッジ時間 1,620 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int solve(const vector<string>& s)
{
    int n = s.size();
    int ans = 0;
    for(int i=0; i<n; ++i){
        if(s[i].substr(0, n-1) == string(n-1, '.') || s[i].substr(1) == string(n-1, '.'))
            ++ ans;
    }
    return ans;
}

int main()
{
    int n;
    cin >> n;
    vector<string> s(n);
    for(int i=0; i<n; ++i)
        cin >> s[i];

    int ans = 0;
    for(int a=0; a<4; ++a){
        for(int b=0; b<2; ++b){
            bool ok = true;
            for(int i=0; i<n-1; ++i){
                if(s[i][0] == '#')
                    ok = false;
            }
            if(ok){
                for(int i=0; i<n-1; ++i)
                    s[i][0] = '#';
                ans = max(ans, solve(s) + 1);
                for(int i=0; i<n-1; ++i)
                    s[i][0] = '.';
            }
            else{
                ans = max(ans, solve(s));
            }

            for(int i=0; i<n/2; ++i){
                for(int j=0; j<n; ++j){
                    swap(s[i][j], s[n-1-i][j]);
                }
            }
        }

        vector<string> t(n, string(n, ' '));
        for(int i=0; i<n; ++i){
            for(int j=0; j<n; ++j){
                t[i][j] = s[j][n-1-i];
            }
        }
        s.swap(t);
    }
    cout << ans << endl;

    return 0;
}
0