結果

問題 No.640 76本のトロンボーン
ユーザー ei1333333ei1333333
提出日時 2018-01-26 22:44:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,236 bytes
コンパイル時間 2,124 ms
コンパイル使用メモリ 201,372 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-27 19:28:40
合計ジャッジ時間 2,978 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main()
{
  int N;
  string S[75];

  cin >> N;
  for(int i = 0; i < N; i++) {
    cin >> S[i];
  }

  auto solve = [&]()
  {
    int ret = 0;
    {
      bool latte = true, malta = true;

      for(int i = 1; i < N; i++) {
        latte &= S[0][i] == '.';
      }
      for(int i = 0; i < N - 1; i++) {
        malta &= S[0][i] == '.';
      }
      ret += latte | malta;
    }

    int cost1 = 0;
    for(int i = 1; i < N; i++) {
      bool latte = true, malta = true;
      for(int j = 1; j < N; j++) {
        latte &= S[i][j] == '.';
      }
      for(int j = 0; j < N - 1; j++) {
        malta &= S[i][j] == '.';
      }
      cost1 += latte | malta;
    }


    int cost2 = 0;
    for(int i = 0; i < N; i++) {
      bool isall = true;
      for(int j = 1; j < N; j++) {
        isall &= S[j][i] == '.';
      }
      cost2 += isall;
    }

    ret += max(cost1, cost2);
    return (ret);
  };

  int ret = 0;

  for(int i = 0; i < 4; i++) {
    string T[75];
    
    for(int j = 0; j < N; j++) {
      T[j].resize(N);
      for(int k = 0; k < N; k++) {
        T[j][k] = S[k][N - j - 1];
      }
    }
    swap(T, S);

    ret = max(ret, solve());

  }
  cout << ret << endl;
}
0