結果
問題 | No.2692 How Many Times Reached? |
ユーザー | ゆにぽけ |
提出日時 | 2024-03-22 21:31:56 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,646 bytes |
コンパイル時間 | 1,296 ms |
コンパイル使用メモリ | 129,460 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-09-30 10:56:19 |
合計ジャッジ時間 | 2,254 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 43 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <array> #include <iterator> #include <string> #include <cctype> #include <cstring> #include <cstdlib> #include <cassert> #include <cmath> #include <ctime> #include <iomanip> #include <numeric> #include <stack> #include <queue> #include <map> #include <unordered_map> #include <set> #include <unordered_set> #include <bitset> #include <random> #include <utility> #include <functional> using namespace std; void Main() { int N; cin >> N; vector<string> S(N); for(int i = 0;i < N;i++) { cin >> S[i]; } int ans = 0; for(int i = 0;i < N;i++) { for(int j = 0;j < N;j++) { if(S[i][j] == '.') { { bool ok = true; for(int k = 0;k < N;k++) { if(k != j && S[i][k] != 'A') { ok = false; break; } } if(ok) { ans++; } } { bool ok = true; for(int k = 0;k < N;k++) { if(k != i && S[k][j] != 'A') { ok = false; break; } } if(ok) { ans++; } } if(i == j) { bool ok = true; for(int k = 0;k < N;k++) { if(k != i && S[k][k] != 'A') { ok = false; } } if(ok) { ans++; } } if(i + j == N - 1) { bool ok = true; for(int k = 0;k < N;k++) { if(k != i && S[k][N - k - 1] != 'A') { ok = false; } } if(ok) { ans++; } } } } } cout << ans << "\n"; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int tt = 1; /* cin >> tt; */ while(tt--) Main(); }