結果
| 問題 |
No.2692 How Many Times Reached?
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-23 12:35:15 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,546 bytes |
| コンパイル時間 | 2,634 ms |
| コンパイル使用メモリ | 217,020 KB |
| 最終ジャッジ日時 | 2025-02-20 13:14:00 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 43 |
ソースコード
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
return (ull)rng() % B;
}
inline double time() {
return static_cast<long double>(chrono::duration_cast<chrono::nanoseconds>(chrono::steady_clock::now().time_since_epoch()).count()) * 1e-9;
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n; cin >> n;
vector<string> s(n);
for (int i = 0; i < n; ++i) {
cin >> s[i];
}
int res = 0;
for (int i = 0; i < n; ++i) {
int a = 0, b = 0;
for (int j = 0; j < n; ++j) {
if (s[i][j] == 'A') a += 1;
else if (s[i][j] == '.') b += 1;
}
if (a == n-1 and b) res += 1;
}
for (int i = 0; i < n; ++i) {
int a = 0, b = 0;
for (int j = 0; j < n; ++j) {
if (s[j][i] == 'A') a += 1;
else if (s[j][i] == '.') b += 1;
}
if (a == n-1 and b) res += 1;
}
{
int a = 0, b = 0;
for (int j = 0; j < n; ++j) {
if (s[j][j] == 'A') a += 1;
else if (s[j][j] == '.') b += 1;
}
if (a == n-1 and b) res += 1;
}
{
int a = 0, b = 0;
for (int j = 0; j < n; ++j) {
if (s[n-1-j][j] == 'A') a += 1;
else if (s[n-1-j][j] == '.') b += 1;
}
if (a == n-1 and b) res += 1;
}
cout << res << endl;
}