結果
| 問題 |
No.2692 How Many Times Reached?
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-22 21:50:10 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,145 bytes |
| コンパイル時間 | 2,743 ms |
| コンパイル使用メモリ | 249,244 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-09-30 11:18:54 |
| 合計ジャッジ時間 | 3,993 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 39 WA * 4 |
ソースコード
// 2692
#include <bits/stdc++.h>
using namespace std;
int N;
vector<string> S;
int check(int y, int x) {
int ret = 0;
if (S[y][x] != '.') return 0;
// yoko
auto T = S[y];
T[x] = 'A';
if (T == string(N, 'A')) ret++;
// tate
bool tate = true;
for (int i = 0; i < N; i++) {
if (i == y) continue;
if (S[i][x] != 'A') {
tate = false;
break;
}
}
if (tate) ret++;
// \naname
if (x == y) {
bool naname1 = true;
for (int i = 0; i < N; i++) {
if (i == x) continue;
if (S[i][i] != 'A') {
naname1 = false;
break;
}
}
if (naname1) ret++;
}
// /naname
if (x == N - 1 - y) {
bool naname2 = true;
for (int i = 0; i < N; i++) {
if (i == x) continue;
if (S[i][N-1-i] != 'A') {
naname2 = false;
break;
}
}
if (naname2) ret++;
}
return ret;
}
int main() { cin.tie(0)->sync_with_stdio(0);
cin >> N;
S.resize(N);
for (auto&& s : S) cin >> s;
int ans = 0;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
ans += check(i, j);
}
}
cout << ans << endl;
return 0;
}