結果

問題 No.2692 How Many Times Reached?
ユーザー AerenAeren
提出日時 2024-03-22 21:47:04
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,230 bytes
コンパイル時間 2,807 ms
コンパイル使用メモリ 248,860 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-09-30 11:15:54
合計ジャッジ時間 3,592 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

// #pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
// #include <x86intrin.h>
using namespace std;
#if __cplusplus >= 202002L
using namespace numbers;
#endif



int main(){
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(ios::badbit | ios::failbit);
	int n;
	cin >> n;
	vector<string> a(n);
	copy_n(istream_iterator<string>(cin), n, a.begin());
	int res = 0;
	for(auto i = 0; i < n; ++ i){
		int cnt = 0;
		for(auto j = 0; j < n; ++ j){
			if(a[i][j] == 'B'){
				goto FAIL0;
			}
			cnt += a[i][j] == '.';
			if(cnt >= 2){
				goto FAIL0;
			}
		}
		++ res;
		FAIL0:;
	}
	for(auto j = 0; j < n; ++ j){
		int cnt = 0;
		for(auto i = 0; i < n; ++ i){
			if(a[i][j] == 'B'){
				goto FAIL1;
			}
			cnt += a[i][j] == '.';
			if(cnt >= 2){
				goto FAIL1;
			}
		}
		++ res;
		FAIL1:;
	}
	{
		int cnt = 0;
		for(auto i = 0; i < n; ++ i){
			if(a[i][i] == 'B'){
				goto FAIL2;
			}
			cnt += a[i][i] == '.';
			if(cnt >= 2){
				goto FAIL2;
			}
		}
		++ res;
		FAIL2:;
	}
	{
		int cnt = 0;
		for(auto i = 0; i < n; ++ i){
			if(a[i][n - 1 - i] == 'B'){
				goto FAIL3;
			}
			cnt += a[i][n - 1 - i] == '.';
			if(cnt >= 2){
				goto FAIL3;
			}
		}
		++ res;
		FAIL3:;
	}
	cout << res << "\n";
	return 0;
}

/*

*/
0