結果
問題 | No.2692 How Many Times Reached? |
ユーザー |
![]() |
提出日時 | 2024-03-22 21:58:27 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,386 bytes |
コンパイル時間 | 2,657 ms |
コンパイル使用メモリ | 202,640 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-09-30 11:30:09 |
合計ジャッジ時間 | 3,577 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 43 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define all(v) (v).begin(),(v).end()#define pb(a) push_back(a)#define rep(i, n) for(int i=0;i<n;i++)#define foa(e, v) for(auto&& e : v)using ll = long long;const ll MOD7 = 1000000007, MOD998 = 998244353, INF = (1LL << 60);#define dout(a) cout<<fixed<<setprecision(10)<<a<<endl;int main() {cin.tie(0);ios::sync_with_stdio(false);ll n;cin >> n;vector<string> s(n);rep(i, n) {cin >> s[i];}ll ans = 0;rep(i, n) {ll sum = 0;bool ng = false;rep(j, n) {sum += (s[i][j] == 'A');ng |= (s[i][j] == 'B');}if(sum == n - 1 and !ng) ans ++;}rep(j, n) {ll sum = 0;bool ng = false;rep(i, n) {sum += (s[i][j] == 'A');ng |= (s[i][j] == 'B');}if(sum == n - 1 and !ng) ans ++;}{ll sum = 0;bool ng = false;rep(i, n) {sum += (s[i][i] == 'A');ng |= (s[i][i] == 'B');}if(sum == n - 1 and !ng) ans ++;}{ll sum = 0;bool ng = false;rep(i, n) {sum += (s[i][n - i - 1] == 'A');ng |= (s[i][n - i - 1] == 'B');}if(sum == n - 1 and !ng) ans ++;}cout << ans << endl;return 0;}