結果

問題 No.2692 How Many Times Reached?
ユーザー hatsuka_iwahatsuka_iwa
提出日時 2024-03-22 21:49:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 950 bytes
コンパイル時間 1,592 ms
コンパイル使用メモリ 170,984 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2024-03-22 21:49:16
合計ジャッジ時間 2,949 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
6,548 KB
testcase_02 AC 2 ms
6,548 KB
testcase_03 AC 2 ms
6,548 KB
testcase_04 AC 1 ms
6,548 KB
testcase_05 AC 2 ms
6,548 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
6,548 KB
testcase_09 WA -
testcase_10 AC 2 ms
6,548 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 2 ms
6,548 KB
testcase_14 AC 2 ms
6,548 KB
testcase_15 AC 2 ms
6,548 KB
testcase_16 AC 2 ms
6,548 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 1 ms
6,548 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 2 ms
6,548 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 2 ms
6,548 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 AC 2 ms
6,548 KB
testcase_45 AC 2 ms
6,548 KB
testcase_46 AC 2 ms
6,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, Ans = 0, AC = 0, BC = 0; cin >> N;
  vector<string> S(N); for (string &T : S) cin >> T;

  for (int i = 0; i < N; i++) {
    AC = 0, BC = 0;
    for (int j = 0; j < N; j++) {
      if (S.at(i).at(j) == 'A') AC++;
      if (S.at(i).at(j) == 'B') BC++;
    }
    if (AC == N - 1 && BC == 0) Ans++;
  }

  for (int i = 0; i < N; i++) {
    AC = 0, BC = 0;
    for (int j = 0; j < N; j++) {
      if (S.at(j).at(i) == 'A') AC++;
      if (S.at(i).at(j) == 'B') BC++;
    }
    if (AC == N - 1 && BC == 0) Ans++;
  }

  AC = 0, BC = 0;
  for (int i = 0; i < N; i++) {
    if (S.at(i).at(i) == 'A') AC++;
    if (S.at(i).at(i) == 'B') BC++;
  }
  if (AC == N - 1 && BC == 0) Ans++;

  AC = 0, BC = 0;
  for (int i = 0; i < N; i++) {
    if (S.at(N - i - 1).at(i) == 'A') AC++;
    if (S.at(N - i - 1).at(i) == 'B') BC++;
  }
  if (AC == N - 1 && BC == 0) Ans++;

  cout << Ans << endl;
}
0