結果
問題 | No.2692 How Many Times Reached? |
ユーザー |
|
提出日時 | 2024-03-22 21:53:09 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 606 bytes |
コンパイル時間 | 2,521 ms |
コンパイル使用メモリ | 246,460 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-30 11:21:41 |
合計ジャッジ時間 | 3,591 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 43 |
ソースコード
#include<bits/stdc++.h>using namespace std;int main(){int n,a,b,c,d,ans=0;cin>>n;vector<string> A(n);for(auto &s:A)cin>>s;for(int i=0;i<n;i++){a=b=c=d=0;for(int j=0;j<n;j++){if(A[i][j]=='.')b++;else if(A[i][j]=='A')a++;if(A[j][i]=='.')d++;else if(A[j][i]=='A')c++;}if(a==n-1&&b==1)ans++;if(c==n-1&&d==1)ans++;}a=b=c=d=0;for(int i=0;i<n;i++){if(A[i][i]=='.')b++;else if(A[i][i]=='A')a++;if(A[i][n-1-i]=='.')d++;else if(A[i][n-1-i]=='A')c++;}if(a==n-1&&b==1)ans++;if(c==n-1&&d==1)ans++;cout<<ans;}