結果
| 問題 | No.2692 How Many Times Reached? | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-03-21 10:25:25 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 807 bytes | 
| コンパイル時間 | 584 ms | 
| コンパイル使用メモリ | 72,744 KB | 
| 実行使用メモリ | 5,888 KB | 
| 最終ジャッジ日時 | 2025-03-21 10:25:28 | 
| 合計ジャッジ時間 | 2,217 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 43 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:13:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
            
            ソースコード
#include<iostream>
#include<vector>
#include<cassert>
#define rep(i,n) for(i=0;i<(int)(n);i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int n;
int main(){
    int i,j,na1=0,na2=0;
    scanf("%d",&n);
    vector<int> row(n,0),col(n,0);
    string str;
    const int NIL=-n;
    rep(i,n){
        cin>>str;
        rep(j,n){
            if(str[j]=='A'){
                row[i]++;
                col[j]++;
                if(i==j)na1++;
                if(j==n-1-i)na2++;
            }else if(str[j]=='B'){
                row[i]=NIL;
                col[j]=NIL;
                if(i==j)na1=NIL;
                if(j==n-1-i)na2=NIL;
            }
        }
    }
    j=(na1==n-1)+(na2==n-1);
    rep(i,n)j+=(row[i]==n-1)+(col[i]==n-1);
    printf("%d\n",j);
    return 0;
}
            
            
            
        