結果

問題 No.2692 How Many Times Reached?
ユーザー soldraysoldray
提出日時 2024-03-26 21:39:16
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,042 bytes
コンパイル時間 2,227 ms
コンパイル使用メモリ 165,768 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-09-30 14:26:10
合計ジャッジ時間 4,423 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

#define yn(pope) (pope ? "Yes" : "No")

#define rep(i, n, m) for (int i = (n); i < (m); i++)
#define rrep(i, n, m) for (int i = (n); i > m; i--)

#define IINF (1 << 30)
#define INF (1ll << 60)

#define all(v) v.begin(), v.end()

int main() {
  int N;
  cin >> N;

  vector M(N, vector(N, '.'));

  rep(i, 0, N) {
    rep(j, 0, N) { cin >> M[j][i]; }
  }

  auto hori = [&]() -> int {
    int count = 0;

    rep(i, 0, N) {
      int c = 0;

      rep(j, 0, N) {
        if (M[j][i] == 'A') { c++; }
      }

      count += (c == N);
    }

    return count;
  };

  auto vert = [&]() -> int {
    int count = 0;

    rep(j, 0, N) {
      int c = 0;

      rep(i, 0, N) {
        if (M[j][i] == 'A') { c++; }
      }

      count += (c == N);
    }

    return count;
  };

  int ans = 0;

  rep(i, 0, N) {
    rep(j, 0, N) {
      char t = M[j][i];
      M[j][i] = 'A';
      ans += (hori() + vert());
      M[j][i] = t;
    }
  }

  cout << ans << endl;

  return 0;
}
0